git.delta.rocks / unique-network / refs/commits / c3c05030805b

difftreelog

Merge pull request #48 from usetech-llc/feature/NFTPAR-240

Greg Zaitsev2020-12-23parents: #8686594 #d21fc88.patch.diff
in: master
nftpar 240 positive tests

2 files changed

addedtests/src/createItem.test.tsdiffbeforeafterboth

no changes

modifiedtests/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);
+  });
+}