difftreelog
Fix after review
in: master
Accounts moved inside describe
4 files changed
tests/src/burnItem.test.tsdiffbeforeafterboth--- a/tests/src/burnItem.test.ts
+++ b/tests/src/burnItem.test.ts
@@ -17,11 +17,12 @@
import {IKeyringPair} from '@polkadot/types/types';
import {expect, itSub, Pallets, usingPlaygrounds} from './util/playgrounds';
-let donor: IKeyringPair;
-let alice: IKeyringPair;
-let bob: IKeyringPair;
describe('integration test: ext. burnItem():', () => {
+ let donor: IKeyringPair;
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
donor = privateKey('//Alice');
@@ -34,7 +35,7 @@
const token = await collection.mintToken(alice);
await token.burn(alice);
- expect(await token.isExist()).to.be.false;
+ expect(await token.doesExist()).to.be.false;
});
itSub('Burn item in Fungible collection', async ({helper}) => {
@@ -73,6 +74,10 @@
});
describe('integration test: ext. burnItem() with admin permissions:', () => {
+ let donor: IKeyringPair;
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
donor = privateKey('//Alice');
@@ -87,7 +92,7 @@
const token = await collection.mintToken(alice);
await token.burnFrom(bob, {Substrate: alice.address});
- expect(await token.isExist()).to.be.false;
+ expect(await token.doesExist()).to.be.false;
});
itSub('Burn item in Fungible collection', async ({helper}) => {
@@ -107,11 +112,15 @@
const token = await collection.mintToken(alice, 100n);
await token.burnFrom(bob, {Substrate: alice.address}, 100n);
- expect(await token.isExist()).to.be.false;
+ expect(await token.doesExist()).to.be.false;
});
});
describe('Negative integration test: ext. burnItem():', () => {
+ let donor: IKeyringPair;
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
donor = privateKey('//Alice');
tests/src/fungible.test.tsdiffbeforeafterboth--- a/tests/src/fungible.test.ts
+++ b/tests/src/fungible.test.ts
@@ -101,10 +101,10 @@
const collection = await helper.ft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
await collection.mint(alice, 500n);
- expect(await collection.isTokenExists(0)).to.be.true;
+ expect(await collection.doesTokenExist(0)).to.be.true;
expect(await collection.getBalance({Substrate: alice.address})).to.be.equal(500n);
expect(await collection.burnTokens(alice, 499n)).to.be.true;
- expect(await collection.isTokenExists(0)).to.be.true;
+ expect(await collection.doesTokenExist(0)).to.be.true;
expect(await collection.getBalance({Substrate: alice.address})).to.be.equal(1n);
});
@@ -112,9 +112,9 @@
const collection = await helper.ft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
await collection.mint(alice, 500n);
- expect(await collection.isTokenExists(0)).to.be.true;
+ expect(await collection.doesTokenExist(0)).to.be.true;
expect(await collection.burnTokens(alice, 500n)).to.be.true;
- expect(await collection.isTokenExists(0)).to.be.true;
+ expect(await collection.doesTokenExist(0)).to.be.true;
expect(await collection.getBalance({Substrate: alice.address})).to.be.equal(0n);
expect(await collection.getTotalPieces()).to.be.equal(0n);
tests/src/refungible.test.tsdiffbeforeafterboth--- a/tests/src/refungible.test.ts
+++ b/tests/src/refungible.test.ts
@@ -122,10 +122,10 @@
itSub('Burn some pieces', async ({helper}) => {
const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
const token = await collection.mintToken(alice, 100n);
- expect(await collection.isTokenExists(token.tokenId)).to.be.true;
+ expect(await collection.doesTokenExist(token.tokenId)).to.be.true;
expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);
expect(await token.burn(alice, 99n)).to.be.true;
- expect(await collection.isTokenExists(token.tokenId)).to.be.true;
+ expect(await collection.doesTokenExist(token.tokenId)).to.be.true;
expect(await token.getBalance({Substrate: alice.address})).to.be.equal(1n);
});
@@ -133,18 +133,18 @@
const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
const token = await collection.mintToken(alice, 100n);
- expect(await collection.isTokenExists(token.tokenId)).to.be.true;
+ expect(await collection.doesTokenExist(token.tokenId)).to.be.true;
expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);
expect(await token.burn(alice, 100n)).to.be.true;
- expect(await collection.isTokenExists(token.tokenId)).to.be.false;
+ expect(await collection.doesTokenExist(token.tokenId)).to.be.false;
});
itSub('Burn some pieces for multiple users', async ({helper}) => {
const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
const token = await collection.mintToken(alice, 100n);
- expect(await collection.isTokenExists(token.tokenId)).to.be.true;
+ expect(await collection.doesTokenExist(token.tokenId)).to.be.true;
expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);
expect(await token.transfer(alice, {Substrate: bob.address}, 60n)).to.be.true;
@@ -154,17 +154,17 @@
expect(await token.burn(alice, 40n)).to.be.true;
- expect(await collection.isTokenExists(token.tokenId)).to.be.true;
+ expect(await collection.doesTokenExist(token.tokenId)).to.be.true;
expect(await token.getBalance({Substrate: alice.address})).to.be.equal(0n);
expect(await token.burn(bob, 59n)).to.be.true;
expect(await token.getBalance({Substrate: bob.address})).to.be.equal(1n);
- expect(await collection.isTokenExists(token.tokenId)).to.be.true;
+ expect(await collection.doesTokenExist(token.tokenId)).to.be.true;
expect(await token.burn(bob, 1n)).to.be.true;
- expect(await collection.isTokenExists(token.tokenId)).to.be.false;
+ expect(await collection.doesTokenExist(token.tokenId)).to.be.false;
});
itSub('Set allowance for token', async ({helper}) => {
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth1109 return (await this.helper.callRpc('api.rpc.unique.lastTokenId', [collectionId])).toNumber();1109 return (await this.helper.callRpc('api.rpc.unique.lastTokenId', [collectionId])).toNumber();1110 }1110 }111111111112 /**1112 /**1113 * Check if token exists1113 * Check if token exists1114 *1114 *1115 * @param collectionId ID of collection1115 * @param collectionId ID of collection1116 * @param tokenId ID of token1116 * @param tokenId ID of token1117 * @example isTokenExists(10, 20);1117 * @example doesTokenExist(10, 20);1118 * @returns true if the token exists, otherwise false1118 * @returns true if the token exists, otherwise false1119 */1119 */1120 async isTokenExists(collectionId: number, tokenId: number): Promise<boolean> {1120 async doesTokenExist(collectionId: number, tokenId: number): Promise<boolean> {1121 return (await this.helper.callRpc('api.rpc.unique.tokenExists', [collectionId, tokenId])).toJSON();1121 return (await this.helper.callRpc('api.rpc.unique.tokenExists', [collectionId, tokenId])).toJSON();1122 }1122 }1123}1123}2277 return await this.helper.collection.getLastTokenId(this.collectionId);2277 return await this.helper.collection.getLastTokenId(this.collectionId);2278 }2278 }227922792280 async isTokenExists(tokenId: number) {2280 async doesTokenExist(tokenId: number) {2281 return await this.helper.collection.isTokenExists(this.collectionId, tokenId);2281 return await this.helper.collection.doesTokenExist(this.collectionId, tokenId);2282 }2282 }228322832284 async getAdmins() {2284 async getAdmins() {2607 return await this.collection.deleteTokenProperties(signer, this.tokenId, propertyKeys);2607 return await this.collection.deleteTokenProperties(signer, this.tokenId, propertyKeys);2608 }2608 }260926092610 async isExist() {2610 async doesExist() {2611 return await this.collection.isTokenExists(this.tokenId);2611 return await this.collection.doesTokenExist(this.tokenId);2612 }2612 }261326132614 nestingAccount() {2614 nestingAccount() {