Files
bch-dex/test/e2e/manual/01-create-order.js
T

39 lines
828 B
JavaScript
Raw Normal View History

2022-02-23 05:51:12 -08:00
/*
A manual e2e test for creating an Order, which then generates an Offer through
the P2WDB webhook.
2022-02-23 05:51:12 -08:00
Ensure the REST API is up an running before running this test.
*/
const axios = require('axios')
2022-03-01 18:36:15 -08:00
const LOCALHOST = 'http://localhost:5700'
2022-02-23 05:51:12 -08:00
async function start () {
try {
const mockOrder = {
2022-02-23 05:51:12 -08:00
lokadId: 'SWP',
messageType: 1,
messageClass: 1,
tokenId:
2022-02-23 10:07:00 -08:00
'a4fb5c2da1aa064e25018a43f9165040071d9e984ba190c222a7f59053af84b2',
2022-02-23 05:51:12 -08:00
buyOrSell: 'sell',
rateInSats: 1000,
2022-02-23 10:07:00 -08:00
minSatsToExchange: 1000,
numTokens: 1
2022-02-23 05:51:12 -08:00
}
const options = {
method: 'post',
url: `${LOCALHOST}/order`,
data: { order: mockOrder }
2022-02-23 05:51:12 -08:00
}
const result = await axios(options)
console.log('result.data: ', result.data)
} catch (err) {
console.log(err)
}
}
start()