Skip to content
Snippets Groups Projects
Commit 4ae9d194 authored by Gomez Goiri, Aitor's avatar Gomez Goiri, Aitor
Browse files

Creating several individual assets in the simulation

parent 9ca47c44
No related branches found
No related tags found
No related merge requests found
...@@ -42,26 +42,34 @@ const simulateCycle = async (arg1, cmd) => { ...@@ -42,26 +42,34 @@ const simulateCycle = async (arg1, cmd) => {
await signInAs(apiClient, otherArgs.sidenorUser, password) await signInAs(apiClient, otherArgs.sidenorUser, password)
let batchId = await createAssetAndSendToCone(apiClient, "simulated asset 1") let stockId
//batchId = await createAssetAndSendToCone(apiClient, "simulated asset 2") for (let simId of [1, 2, 3]) {
//batchId = await createAssetAndSendToCone(apiClient, "simulated asset 3") const batchId = await createAssetAndSendToCone(
apiClient,
const mergedStock = await sendToStock(apiClient, { assetId: batchId }) `simulated asset ${simId}`
const selectedStockId = await discardStock(apiClient, { )
assetId: mergedStock.id let mergedStock = await sendToStock(apiClient, {
assetId: batchId,
// The first time the user should select the stock as it is not provided
stockId
}) })
stockId = mergedStock.id
}
const selectedStockId = await discardStock(apiClient, { assetId: stockId })
const selectedStock = await apiClient.getAsset(selectedStockId) const selectedStock = await apiClient.getAsset(selectedStockId)
await signInAs(apiClient, otherArgs.cement1User, password) await signInAs(apiClient, otherArgs.cement1User, password)
await bidAsset(apiClient, { await bidAsset(apiClient, {
assetId: selectedStockId, assetId: selectedStockId,
quantity: faker.datatype.number({ min: 200, max: selectedStock.quantity }),
price: faker.datatype.number({ min: 50, max: 150 }) price: faker.datatype.number({ min: 50, max: 150 })
}) })
await signInAs(apiClient, otherArgs.cement2User, password) await signInAs(apiClient, otherArgs.cement2User, password)
await bidAsset(apiClient, { await bidAsset(apiClient, {
assetId: selectedStockId, assetId: selectedStockId,
quantity: selectedStock.quantity - 500, quantity: faker.datatype.number({ min: 100, max: selectedStock.quantity }),
price: faker.datatype.number({ min: 25, max: 200 }) price: faker.datatype.number({ min: 25, max: 200 })
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment