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
1142 });1142 });
1143}1143}
1144
1145export async function addToWhiteListAgainExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | AccountId) {
1146 await usingApi(async (api) => {
1147
1148 const whiteListedBefore = (await api.query.nft.whiteList(collectionId, address)).toJSON();
1149
1150 // Run the transaction
1151 const tx = api.tx.nft.addToWhiteList(collectionId, normalizeAccountId(address));
1152 const events = await submitTransactionAsync(sender, tx);
1153 const result = getGenericResult(events);
1154
1155 const whiteListedAfter = (await api.query.nft.whiteList(collectionId, address)).toJSON();
1156
1157 // What to expect
1158 // tslint:disable-next-line:no-unused-expression
1159 expect(result.success).to.be.true;
1160 // tslint:disable-next-line: no-unused-expression
1161 expect(whiteListedBefore).to.be.true;
1162 // tslint:disable-next-line: no-unused-expression
1163 expect(whiteListedAfter).to.be.true;
1164 });
1165}
11441166
1145export async function addToWhiteListExpectFail(sender: IKeyringPair, collectionId: number, address: string | AccountId) {1167export async function addToWhiteListExpectFail(sender: IKeyringPair, collectionId: number, address: string | AccountId) {
1146 await usingApi(async (api) => {1168 await usingApi(async (api) => {
1169
1147 // Run the transaction1170 // Run the transaction
1148 const tx = api.tx.nft.addToWhiteList(collectionId, normalizeAccountId(address));1171 const tx = api.tx.nft.addToWhiteList(collectionId, normalizeAccountId(address));
1149 const events = await expect(submitTransactionAsync(sender, tx)).to.be.rejected;1172 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
1150 const result = getGenericResult(events);1173 const result = getGenericResult(events);
11511174
1152 // What to expect1175 // What to expect
addedtests/src/whiteLists.test.tsdiffbeforeafterboth

no changes