git.delta.rocks / unique-network / refs/commits / 55c7c972e8a3

difftreelog

Fix after review

Max Andreev2022-10-04parent: #f6544e6.patch.diff
in: master
Accounts moved inside describe

4 files changed

modifiedtests/src/burnItem.test.tsdiffbeforeafterboth
17import {IKeyringPair} from '@polkadot/types/types';17import {IKeyringPair} from '@polkadot/types/types';
18import {expect, itSub, Pallets, usingPlaygrounds} from './util/playgrounds';18import {expect, itSub, Pallets, usingPlaygrounds} from './util/playgrounds';
1919
20let donor: IKeyringPair;
21let alice: IKeyringPair;
22let bob: IKeyringPair;
2320
24describe('integration test: ext. burnItem():', () => {21describe('integration test: ext. burnItem():', () => {
22 let donor: IKeyringPair;
23 let alice: IKeyringPair;
24 let bob: IKeyringPair;
25
25 before(async () => {26 before(async () => {
26 await usingPlaygrounds(async (helper, privateKey) => {27 await usingPlaygrounds(async (helper, privateKey) => {
34 const token = await collection.mintToken(alice);35 const token = await collection.mintToken(alice);
3536
36 await token.burn(alice);37 await token.burn(alice);
37 expect(await token.isExist()).to.be.false;38 expect(await token.doesExist()).to.be.false;
38 });39 });
3940
40 itSub('Burn item in Fungible collection', async ({helper}) => {41 itSub('Burn item in Fungible collection', async ({helper}) => {
73});74});
7475
75describe('integration test: ext. burnItem() with admin permissions:', () => {76describe('integration test: ext. burnItem() with admin permissions:', () => {
77 let donor: IKeyringPair;
78 let alice: IKeyringPair;
79 let bob: IKeyringPair;
80
76 before(async () => {81 before(async () => {
77 await usingPlaygrounds(async (helper, privateKey) => {82 await usingPlaygrounds(async (helper, privateKey) => {
87 const token = await collection.mintToken(alice);92 const token = await collection.mintToken(alice);
8893
89 await token.burnFrom(bob, {Substrate: alice.address});94 await token.burnFrom(bob, {Substrate: alice.address});
90 expect(await token.isExist()).to.be.false;95 expect(await token.doesExist()).to.be.false;
91 });96 });
9297
93 itSub('Burn item in Fungible collection', async ({helper}) => {98 itSub('Burn item in Fungible collection', async ({helper}) => {
107 const token = await collection.mintToken(alice, 100n);112 const token = await collection.mintToken(alice, 100n);
108113
109 await token.burnFrom(bob, {Substrate: alice.address}, 100n);114 await token.burnFrom(bob, {Substrate: alice.address}, 100n);
110 expect(await token.isExist()).to.be.false;115 expect(await token.doesExist()).to.be.false;
111 });116 });
112});117});
113118
114describe('Negative integration test: ext. burnItem():', () => {119describe('Negative integration test: ext. burnItem():', () => {
120 let donor: IKeyringPair;
121 let alice: IKeyringPair;
122 let bob: IKeyringPair;
123
115 before(async () => {124 before(async () => {
116 await usingPlaygrounds(async (helper, privateKey) => {125 await usingPlaygrounds(async (helper, privateKey) => {
modifiedtests/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);
modifiedtests/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}) => {
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -1114,10 +1114,10 @@
    *
    * @param collectionId ID of collection
    * @param tokenId ID of token
-   * @example isTokenExists(10, 20);
+   * @example doesTokenExist(10, 20);
    * @returns true if the token exists, otherwise false
    */
-  async isTokenExists(collectionId: number, tokenId: number): Promise<boolean> {
+  async doesTokenExist(collectionId: number, tokenId: number): Promise<boolean> {
     return (await this.helper.callRpc('api.rpc.unique.tokenExists', [collectionId, tokenId])).toJSON();
   }
 }
@@ -2277,8 +2277,8 @@
     return await this.helper.collection.getLastTokenId(this.collectionId);
   }
 
-  async isTokenExists(tokenId: number) {
-    return await this.helper.collection.isTokenExists(this.collectionId, tokenId);
+  async doesTokenExist(tokenId: number) {
+    return await this.helper.collection.doesTokenExist(this.collectionId, tokenId);
   }
 
   async getAdmins() {
@@ -2607,8 +2607,8 @@
     return await this.collection.deleteTokenProperties(signer, this.tokenId, propertyKeys);
   }
 
-  async isExist() {
-    return await this.collection.isTokenExists(this.tokenId);
+  async doesExist() {
+    return await this.collection.doesTokenExist(this.tokenId);
   }
 
   nestingAccount() {