difftreelog
tests: find not existing ids
in: master
2 files changed
tests/src/setVariableMetaData.test.tsdiffbeforeafterboth8 createCollectionExpectSuccess,8 createCollectionExpectSuccess,9 createItemExpectSuccess,9 createItemExpectSuccess,10 destroyCollectionExpectSuccess,10 destroyCollectionExpectSuccess,11 findNotExistingCollection,11 setVariableMetaDataExpectFailure,12 setVariableMetaDataExpectFailure,12 setVariableMetaDataExpectSuccess,13 setVariableMetaDataExpectSuccess,13} from './util/helpers';14} from './util/helpers';62 });63 });636464 it('fails on not existing collection id', async () => {65 it('fails on not existing collection id', async () => {65 // Not sure how to implement it66 await usingApi(async api => {66 const nonExistingCollectionId = 200000;67 let nonExistingCollectionId = await findNotExistingCollection(api);67 await setVariableMetaDataExpectFailure(alice, nonExistingCollectionId, 1, data);68 await setVariableMetaDataExpectFailure(alice, nonExistingCollectionId, 1, data);69 });68 });70 });69 it('fails on removed collection id', async () => {71 it('fails on removed collection id', async () => {70 const removedCollectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });72 const removedCollectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });81 await setVariableMetaDataExpectFailure(alice, removedTokenCollectionId, removedTokenId, data);83 await setVariableMetaDataExpectFailure(alice, removedTokenCollectionId, removedTokenId, data);82 });84 });83 it('fails on not existing token', async () => {85 it('fails on not existing token', async () => {84 const nonExistingTokenId = 200000;86 const nonExistingTokenId = validTokenId + 1;858786 await setVariableMetaDataExpectFailure(alice, validCollectionId, nonExistingTokenId, data);88 await setVariableMetaDataExpectFailure(alice, validCollectionId, nonExistingTokenId, data);87 });89 });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;