difftreelog
Merge pull request #48 from usetech-llc/feature/NFTPAR-240
in: master
nftpar 240 positive tests
2 files changed
tests/src/createItem.test.tsdiffbeforeafterbothno changes
tests/src/util/helpers.tsdiffbeforeafterboth--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -121,4 +121,22 @@
bal = new BigNumber((await api.query.system.account(unused.address)).data.free.toString());
} while (bal.toFixed() != '0');
return unused;
-}
\ No newline at end of file
+}
+
+export async function createItemExpectSuccess(collectionId: number, createMode: string, senderSeed: string = '//Alice') {
+ await usingApi(async (api) => {
+
+ const AItemCount = parseInt((await api.query.nft.itemListIndex(collectionId)).toString());
+
+ const sender = privateKey(senderSeed);
+ const tx = api.tx.nft.createItem(collectionId, sender.address, createMode);
+ const events = await submitTransactionAsync(sender, tx);
+ const result = getGenericResult(events);
+
+ const BItemCount = parseInt((await api.query.nft.itemListIndex(collectionId)).toString());
+
+ // What to expect
+ expect(result.success).to.be.true;
+ expect(BItemCount).to.be.equal(AItemCount+1);
+ });
+}