test('test negative chain deposit', async () => { debug('Into negative chain deposit test ...') const expectedError = 'Insufficient balance' const chain = config.chains[0] const currencyFullName = `${config.issuers[0].name}.${config.issuers[0].assets[0].name}` const trs = { secret: config.issuers[0].account.secret, type: 204, fee: 10000000, args: [ chain.name, currencyFullName, '60000000000000000', ], } const error = await lib.failTransaction(trs) debug(`--->Actual error is '${error}', expected error is '${expectedError}'`) expect(error).toMatch(new RegExp(expectedError)) })
test('test negative chain withdrawal', async () => { debug('Into negative chain deposit test ...') const expectedError = 'Invalid chain name' const currencyFullName = `${config.issuers[0].name}.${config.issuers[0].assets[0].name}` const trs = { secret: config.issuers[0].account.secret, type: 205, fee: 10000000, args: [ '', config.recipients[0].address, currencyFullName, String(Number(config.issuers[0].assets[0].issueAmount) / 20), 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij', 1234567890, ], } const error = await lib.failTransaction(trs) debug(`--->Actual error is '${error}', expected error is '${expectedError}'`) expect(error).toMatch(new RegExp(expectedError)) })
asset: now.masterVariant.assets[0], variantId: 1, }, asset: now.variants[0].assets[0], sku: 'my-sku', }, assetId: before.variants[0].assets[0].id, variantId: 2, }, assetKey: before.variants[0].assets[0].key, variantId: 2, }, assetKey: before.variants[0].assets[0].key, sku: 'my-sku', }, assetKey: before.variants[0].assets[0].key, variantId: 1, },
test('verify chain withdrawal', async () => { debug('Into verify chain withdrawal test ...') const chain = config.chains[0] const currencyFullName = `${config.issuers[0].name}.${config.issuers[0].assets[0].name}` const trs = { secret: config.issuers[0].account.secret, type: 205, fee: 10000000, args: [ chain.name, config.recipients[0].address, currencyFullName, String(Number(config.issuers[0].assets[0].issueAmount) / 20), 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij', 1234567890, ], } await lib.transactionUnsignedAsync(trs) await lib.onNewBlockAsync() // TODO: If currency is not XAS, check table balances. If currency is XAS, check table accounts // Check table withdrawals })
test('verify chain deposit', async () => { debug('Into verify chain deposit test ...') for (const chain of config.chains) { const currencyFullName = `${config.issuers[0].name}.${config.issuers[0].assets[0].name}` const trs = { secret: config.issuers[0].account.secret, type: 204, fee: 10000000, args: [ chain.name, currencyFullName, String(Number(config.issuers[0].assets[0].issueAmount) / 10), ], } debug(`--->deposit ${currencyFullName} to chain ${chain.name}`) await lib.transactionUnsignedAsync(trs) } await lib.onNewBlockAsync() // TODO: check corresponding changes in table accounts, balances, deposits })
asset: now.masterVariant.assets[0], variantId: 1, }, asset: now.variants[0].assets[0], sku: 'my-sku', }, assetId: before.variants[0].assets[0].id, variantId: 2, }, assetKey: before.variants[0].assets[0].key, variantId: 2, }, assetKey: before.variants[0].assets[0].key, sku: 'my-sku', }, assetKey: before.variants[0].assets[0].key, variantId: 1, },