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

difftreelog

CORE-170. White list tests

str-mv2021-08-05parent: #b255f4b.patch.diff
in: master

2 files changed

modifiedtests/src/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -1142,11 +1142,34 @@
   });
 }
 
+export async function addToWhiteListAgainExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | AccountId) {
+  await usingApi(async (api) => {
+
+    const whiteListedBefore = (await api.query.nft.whiteList(collectionId, address)).toJSON();
+
+    // Run the transaction
+    const tx = api.tx.nft.addToWhiteList(collectionId, normalizeAccountId(address));
+    const events = await submitTransactionAsync(sender, tx);
+    const result = getGenericResult(events);
+
+    const whiteListedAfter = (await api.query.nft.whiteList(collectionId, address)).toJSON();
+
+    // What to expect
+    // tslint:disable-next-line:no-unused-expression
+    expect(result.success).to.be.true;
+    // tslint:disable-next-line: no-unused-expression
+    expect(whiteListedBefore).to.be.true;
+    // tslint:disable-next-line: no-unused-expression
+    expect(whiteListedAfter).to.be.true;
+  });
+}
+
 export async function addToWhiteListExpectFail(sender: IKeyringPair, collectionId: number, address: string | AccountId) {
   await usingApi(async (api) => {
+    
     // Run the transaction
     const tx = api.tx.nft.addToWhiteList(collectionId, normalizeAccountId(address));
-    const events = await expect(submitTransactionAsync(sender, tx)).to.be.rejected;
+    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
     const result = getGenericResult(events);
 
     // What to expect
addedtests/src/whiteLists.test.tsdiffbeforeafterboth

no changes