difftreelog
tests: find not existing ids
in: master
2 files changed
tests/src/setVariableMetaData.test.tsdiffbeforeafterboth--- a/tests/src/setVariableMetaData.test.ts
+++ b/tests/src/setVariableMetaData.test.ts
@@ -8,6 +8,7 @@
createCollectionExpectSuccess,
createItemExpectSuccess,
destroyCollectionExpectSuccess,
+ findNotExistingCollection,
setVariableMetaDataExpectFailure,
setVariableMetaDataExpectSuccess,
} from './util/helpers';
@@ -62,9 +63,10 @@
});
it('fails on not existing collection id', async () => {
- // Not sure how to implement it
- const nonExistingCollectionId = 200000;
- await setVariableMetaDataExpectFailure(alice, nonExistingCollectionId, 1, data);
+ await usingApi(async api => {
+ let nonExistingCollectionId = await findNotExistingCollection(api);
+ await setVariableMetaDataExpectFailure(alice, nonExistingCollectionId, 1, data);
+ });
});
it('fails on removed collection id', async () => {
const removedCollectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });
@@ -81,7 +83,7 @@
await setVariableMetaDataExpectFailure(alice, removedTokenCollectionId, removedTokenId, data);
});
it('fails on not existing token', async () => {
- const nonExistingTokenId = 200000;
+ const nonExistingTokenId = validTokenId + 1;
await setVariableMetaDataExpectFailure(alice, validCollectionId, nonExistingTokenId, data);
});
tests/src/util/helpers.tsdiffbeforeafterboth253 return unused;253 return unused;254}254}255256export async function findNotExistingCollection(api: ApiPromise): Promise<number> {257 let collection: number = parseInt((await api.query.nft.createdCollectionCount()).toString()) as unknown as number + 1;258 return collection;259}255260256function getDestroyResult(events: EventRecord[]): boolean {261function getDestroyResult(events: EventRecord[]): boolean {257 let success: boolean = false;262 let success: boolean = false;