git.delta.rocks / unique-network / refs/commits / 39dc916474d4

difftreelog

tests: fix tests for optional collections

Yaroslav Bolyukin2021-03-22parent: #6a8b360.patch.diff
in: master

10 files changed

modifiedtests/package.jsondiffbeforeafterboth
--- a/tests/package.json
+++ b/tests/package.json
@@ -32,6 +32,7 @@
     "testRemoveFromWhiteList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromWhiteList.test.ts",
     "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",
     "testCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",
+    "testContracts": "mocha --timeout 9999999 -r ts-node/register ./**/contracts.test.ts",
     "testCreateItem": "mocha --timeout 9999999 -r ts-node/register ./**/createItem.test.ts",
     "testCreateMultipleItems": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItems.test.ts",
     "testApprove": "mocha --timeout 9999999 -r ts-node/register ./**/approve.test.ts",
@@ -44,6 +45,7 @@
     "testSetMintPermission": "mocha --timeout 9999999 -r ts-node/register ./**/setMintPermission.test.ts",
     "testCreditFeesToTreasury": "mocha --timeout 9999999 -r ts-node/register ./**/creditFeesToTreasury.test.ts",
     "testEnableContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/enableContractSponsoring.test.ts",
+    "testRemoveFromContractWhiteList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromContractWhiteList.test.ts",
     "testSetContractSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setContractSponsoringRateLimit.test.ts",
     "testSetOffchainSchema": "mocha --timeout 9999999 -r ts-node/register ./**/setOffchainSchema.test.ts",
     "testOverflow": "mocha --timeout 9999999 -r ts-node/register ./**/overflow.test.ts",
modifiedtests/src/approve.test.tsdiffbeforeafterboth
--- a/tests/src/approve.test.ts
+++ b/tests/src/approve.test.ts
@@ -123,9 +123,6 @@
     // nft
     const nftCollectionId = await createCollectionExpectSuccess();
     await approveExpectFail(nftCollectionId, 2, Alice, Bob);
-    // fungible
-    const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
-    await approveExpectFail(fungibleCollectionId, 2, Alice, Bob);
     // reFungible
     const reFungibleCollectionId =
       await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
modifiedtests/src/burnItem.test.tsdiffbeforeafterboth
--- a/tests/src/burnItem.test.ts
+++ b/tests/src/burnItem.test.ts
@@ -46,8 +46,7 @@
       // tslint:disable-next-line:no-unused-expression
       expect(result.success).to.be.true;
       // tslint:disable-next-line:no-unused-expression
-      expect(item).to.be.not.null;
-      expect(item.Owner).to.be.equal(nullPublicKey);
+      expect(item).to.be.null;
     });
 
   });
@@ -88,8 +87,7 @@
       
       // What to expect
       expect(result.success).to.be.true;
-      expect(balance).to.be.not.null;
-      expect(balance.Owner.length).to.be.equal(0);
+      expect(balance).to.be.null;
     });
 
   });
modifiedtests/src/contracts.test.tsdiffbeforeafterboth
--- a/tests/src/contracts.test.ts
+++ b/tests/src/contracts.test.ts
@@ -63,13 +63,13 @@
       const collectionId = await createCollectionExpectSuccess();
       const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');
       const [contract, deployer] = await deployTransferContract(api);
-      const tokenBefore: any = await api.query.nft.nftItemList(collectionId, tokenId);
+      const tokenBefore: any = (await api.query.nft.nftItemList(collectionId, tokenId) as any).unwrap();
       
       // Transfer
       const transferTx = contract.tx.transfer(value, gasLimit, bob.address, collectionId, tokenId, 1);
       const events = await submitTransactionAsync(alice, transferTx);
       const result = getGenericResult(events);
-      const tokenAfter: any = await api.query.nft.nftItemList(collectionId, tokenId);
+      const tokenAfter: any = (await api.query.nft.nftItemList(collectionId, tokenId) as any).unwrap();
 
       // tslint:disable-next-line:no-unused-expression
       expect(result.success).to.be.true;
modifiedtests/src/createMultipleItems.test.tsdiffbeforeafterboth
--- a/tests/src/createMultipleItems.test.ts
+++ b/tests/src/createMultipleItems.test.ts
@@ -38,9 +38,9 @@
       await submitTransactionAsync(Alice, createMultipleItemsTx);
       const itemsListIndexAfter = await api.query.nft.itemListIndex(collectionId) as unknown as BN;
       expect(itemsListIndexAfter.toNumber()).to.be.equal(3);
-      const token1Data = await api.query.nft.nftItemList(collectionId, 1) as unknown as ITokenDataType;
-      const token2Data = await api.query.nft.nftItemList(collectionId, 2) as unknown as ITokenDataType;
-      const token3Data = await api.query.nft.nftItemList(collectionId, 3) as unknown as ITokenDataType;
+      const token1Data = (await api.query.nft.nftItemList(collectionId, 1)).toJSON() as unknown as ITokenDataType;
+      const token2Data = (await api.query.nft.nftItemList(collectionId, 2)).toJSON() as unknown as ITokenDataType;
+      const token3Data = (await api.query.nft.nftItemList(collectionId, 3)).toJSON() as unknown as ITokenDataType;
 
       expect(token1Data.Owner.toString()).to.be.equal(Alice.address);
       expect(token2Data.Owner.toString()).to.be.equal(Alice.address);
@@ -72,9 +72,9 @@
       await submitTransactionAsync(Alice, createMultipleItemsTx);
       const itemsListIndexAfter = await api.query.nft.itemListIndex(collectionId) as unknown as BN;
       expect(itemsListIndexAfter.toNumber()).to.be.equal(3);
-      const token1Data = await api.query.nft.reFungibleItemList(collectionId, 1) as unknown as IReFungibleTokenDataType;
-      const token2Data = await api.query.nft.reFungibleItemList(collectionId, 2) as unknown as IReFungibleTokenDataType;
-      const token3Data = await api.query.nft.reFungibleItemList(collectionId, 3) as unknown as IReFungibleTokenDataType;
+      const token1Data = (await api.query.nft.reFungibleItemList(collectionId, 1) as any).unwrap() as unknown as IReFungibleTokenDataType;
+      const token2Data = (await api.query.nft.reFungibleItemList(collectionId, 2) as any).unwrap() as unknown as IReFungibleTokenDataType;
+      const token3Data = (await api.query.nft.reFungibleItemList(collectionId, 3) as any).unwrap() as unknown as IReFungibleTokenDataType;
 
       expect(token1Data.Owner[0].Owner.toString()).to.be.equal(Alice.address);
       expect(token1Data.Owner[0].Fraction.toNumber()).to.be.equal(1);
modifiedtests/src/removeCollectionAdmin.test.tsdiffbeforeafterboth
--- a/tests/src/removeCollectionAdmin.test.ts
+++ b/tests/src/removeCollectionAdmin.test.ts
@@ -36,6 +36,19 @@
       expect(adminListAfterRemoveAdmin).not.to.be.contains(Bob.address);
     });
   });
+
+  it('Remove admin from collection that has no admins', async () => {
+    await usingApi(async (api: ApiPromise) => {
+      const Alice = privateKey('//Alice');
+      const collectionId = await createCollectionExpectSuccess();
+
+      const adminListBeforeAddAdmin: any = (await api.query.nft.adminList(collectionId));
+      expect(adminListBeforeAddAdmin).to.have.lengthOf(0);
+
+      const tx = api.tx.nft.removeCollectionAdmin(collectionId, Alice.address);
+      await submitTransactionAsync(Alice, tx);
+    });
+  });
 });
 
 describe('Negative Integration Test removeCollectionAdmin(collection_id, account_id):', () => {
@@ -68,19 +81,6 @@
 
       // Verifying that nothing bad happened (network is live, new collections can be created, etc.)
       await createCollectionExpectSuccess();
-    });
-  });
-
-  it('Remove admin from collection that has no admins', async () => {
-    await usingApi(async (api: ApiPromise) => {
-      const Alice = privateKey('//Alice');
-      const collectionId = await createCollectionExpectSuccess();
-
-      const adminListBeforeAddAdmin: any = (await api.query.nft.adminList(collectionId));
-      expect(adminListBeforeAddAdmin).to.have.lengthOf(0);
-
-      const tx = api.tx.nft.removeCollectionAdmin(collectionId, Alice.address);
-      await expect(submitTransactionExpectFailAsync(Alice, tx)).to.be.rejected;
     });
   });
 });
modifiedtests/src/removeFromContractWhiteList.test.tsdiffbeforeafterboth
--- a/tests/src/removeFromContractWhiteList.test.ts
+++ b/tests/src/removeFromContractWhiteList.test.ts
@@ -13,8 +13,10 @@
 describe('Integration Test removeFromContractWhiteList', () => {
     let bob: IKeyringPair;
 
-    before(() => {
-        bob = privateKey('//Bob');
+    before(async () => {
+        await usingApi(async () => {
+            bob = privateKey('//Bob');
+        });
     });
 
     it('user is no longer whitelisted after removal', async () => {
@@ -56,9 +58,11 @@
     let alice: IKeyringPair;
     let bob: IKeyringPair;
 
-    before(() => {
-        alice = privateKey('//Alice');
-        bob = privateKey('//Bob');
+    before(async () => {
+        await usingApi(async () => {
+            alice = privateKey('//Alice');
+            bob = privateKey('//Bob');
+        });
     });
 
     it('fails when called with non-contract address', async () => {
modifiedtests/src/setVariableMetaData.test.tsdiffbeforeafterboth
--- a/tests/src/setVariableMetaData.test.ts
+++ b/tests/src/setVariableMetaData.test.ts
@@ -41,7 +41,7 @@
 
   it('verify data was set', async () => {
     await usingApi(async api => {
-      const item: any = await api.query.nft.nftItemList(collectionId, tokenId);
+      const item: any = (await api.query.nft.nftItemList(collectionId, tokenId) as any).unwrap();
 
       expect(Array.from(item.VariableData)).to.deep.equal(Array.from(data));
     });
modifiedtests/src/transferFrom.test.tsdiffbeforeafterboth
before · tests/src/transferFrom.test.ts
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//5import { ApiPromise } from '@polkadot/api';6import { IKeyringPair } from '@polkadot/types/types';7import chai from 'chai';8import chaiAsPromised from 'chai-as-promised';9import privateKey from './substrate/privateKey';10import { default as usingApi } from './substrate/substrate-api';11import {12  approveExpectFail,13  approveExpectSuccess,14  createCollectionExpectSuccess,15  createFungibleItemExpectSuccess,16  createItemExpectSuccess,17  destroyCollectionExpectSuccess,18  getAllowance,19  transferFromExpectFail,20  transferFromExpectSuccess,21  burnItemExpectSuccess,22  setCollectionLimitsExpectSuccess,23} from './util/helpers';2425chai.use(chaiAsPromised);26const expect = chai.expect;2728describe('Integration Test transferFrom(from, recipient, collection_id, item_id, value):', () => {29  let Alice: IKeyringPair;30  let Bob: IKeyringPair;31  let Charlie: IKeyringPair;3233  before(async () => {34    await usingApi(async (api) => {35      Alice = privateKey('//Alice');36      Bob = privateKey('//Bob');37      Charlie = privateKey('//Charlie');38    });39  });4041  it('Execute the extrinsic and check nftItemList - owner of token', async () => {42    await usingApi(async (api: ApiPromise) => {43      // nft44      const nftCollectionId = await createCollectionExpectSuccess();45      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');46      await approveExpectSuccess(nftCollectionId, newNftTokenId, Alice, Bob);4748      await transferFromExpectSuccess(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1, 'NFT');4950      // fungible51      const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});52      const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');53      await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, Alice, Bob);54      await transferFromExpectSuccess(fungibleCollectionId, newFungibleTokenId, Bob, Alice, Charlie, 1, 'Fungible');55      // reFungible56      const reFungibleCollectionId = await57        createCollectionExpectSuccess({mode: {type: 'ReFungible'}});58      const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');59      await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, Alice, Bob, 100);60      await transferFromExpectSuccess(reFungibleCollectionId,61        newReFungibleTokenId, Bob, Alice, Charlie, 100, 'ReFungible');62    });63  });6465  it('Should reduce allowance if value is big', async () => {66    await usingApi(async () => {67      const alice = privateKey('//Alice');68      const bob = privateKey('//Bob');69      const charlie = privateKey('//Charlie');7071      // fungible72      const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});73      const newFungibleTokenId = await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: 500000n });7475      await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob, 500000n);76      await transferFromExpectSuccess(fungibleCollectionId, newFungibleTokenId, bob, alice, charlie, 500000n, 'Fungible');77      expect((await getAllowance(fungibleCollectionId, newFungibleTokenId, alice.address, bob.address)).toString()).to.equal('0');78    });79  });8081  it('can be called by collection owner on non-owned item when OwnerCanTransfer == true', async () => {82    const collectionId = await createCollectionExpectSuccess();83    const itemId = await createItemExpectSuccess(Alice, collectionId, 'NFT', Bob.address);8485    await transferFromExpectSuccess(collectionId, itemId, Alice, Bob, Charlie);86  });87});8889describe('Negative Integration Test transferFrom(from, recipient, collection_id, item_id, value):', () => {90  let Alice: IKeyringPair;91  let Bob: IKeyringPair;92  let Charlie: IKeyringPair;9394  before(async () => {95    await usingApi(async (api) => {96      Alice = privateKey('//Alice');97      Bob = privateKey('//Bob');98      Charlie = privateKey('//Charlie');99    });100  });101102  it('transferFrom for a collection that does not exist', async () => {103    await usingApi(async (api: ApiPromise) => {104      // nft105      const nftCollectionCount = await api.query.nft.createdCollectionCount() as unknown as number;106      await approveExpectFail(nftCollectionCount + 1, 1, Alice, Bob);107108      await transferFromExpectFail(nftCollectionCount + 1, 1, Bob, Alice, Charlie, 1);109110      // fungible111      const fungibleCollectionCount = await api.query.nft.createdCollectionCount() as unknown as number;112      await approveExpectFail(fungibleCollectionCount + 1, 1, Alice, Bob);113114      await transferFromExpectFail(fungibleCollectionCount + 1, 1, Bob, Alice, Charlie, 1);115      // reFungible116      const reFungibleCollectionCount = await api.query.nft.createdCollectionCount() as unknown as number;117      await approveExpectFail(reFungibleCollectionCount + 1, 1, Alice, Bob);118119      await transferFromExpectFail(reFungibleCollectionCount + 1, 1, Bob, Alice, Charlie, 1);120    });121  });122123  /* it('transferFrom for a collection that was destroyed', async () => {124    await usingApi(async (api: ApiPromise) => {125      this test copies approve negative test126    });127  }); */128129  /* it('transferFrom a token that does not exist', async () => {130    await usingApi(async (api: ApiPromise) => {131      this test copies approve negative test132    });133  }); */134135  /* it('transferFrom a token that was deleted', async () => {136    await usingApi(async (api: ApiPromise) => {137      this test copies approve negative test138    });139  }); */140141  it('transferFrom for not approved address', async () => {142    await usingApi(async (api: ApiPromise) => {143      // nft144      const nftCollectionId = await createCollectionExpectSuccess();145      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');146147      await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1);148149      // fungible150      const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});151      const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');152      await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, Bob, Alice, Charlie, 1);153      // reFungible154      const reFungibleCollectionId = await155        createCollectionExpectSuccess({mode: {type: 'ReFungible'}});156      const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');157      await transferFromExpectFail(reFungibleCollectionId,158        newReFungibleTokenId, Bob, Alice, Charlie, 1);159    });160  });161162  it('transferFrom incorrect token count', async () => {163    await usingApi(async (api: ApiPromise) => {164      // nft165      const nftCollectionId = await createCollectionExpectSuccess();166      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');167      await approveExpectSuccess(nftCollectionId, newNftTokenId, Alice, Bob);168169      await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 2);170171      // fungible172      const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});173      const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');174      await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, Alice, Bob);175      await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, Bob, Alice, Charlie, 2);176      // reFungible177      const reFungibleCollectionId = await178        createCollectionExpectSuccess({mode: {type: 'ReFungible'}});179      const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');180      await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, Alice, Bob);181      await transferFromExpectFail(reFungibleCollectionId,182        newReFungibleTokenId, Bob, Alice, Charlie, 2);183    });184  });185186  it('execute transferFrom from account that is not owner of collection', async () => {187    await usingApi(async (api: ApiPromise) => {188      const Dave = privateKey('//Dave');189      // nft190      const nftCollectionId = await createCollectionExpectSuccess();191      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');192      try {193        await approveExpectFail(nftCollectionId, newNftTokenId, Dave, Bob);194        await transferFromExpectFail(nftCollectionId, newNftTokenId, Dave, Alice, Charlie, 1);195      } catch (e) {196        // tslint:disable-next-line:no-unused-expression197        expect(e).to.be.exist;198      }199200      // await transferFromExpectFail(nftCollectionId, newNftTokenId, Dave, Alice, Charlie, 1);201202      // fungible203      const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});204      const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');205      try {206        await approveExpectFail(fungibleCollectionId, newFungibleTokenId, Dave, Bob);207        await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, Dave, Alice, Charlie, 1);208      } catch (e) {209        // tslint:disable-next-line:no-unused-expression210        expect(e).to.be.exist;211      }212      // reFungible213      const reFungibleCollectionId = await214        createCollectionExpectSuccess({mode: {type: 'ReFungible'}});215      const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');216      try {217        await approveExpectFail(reFungibleCollectionId, newReFungibleTokenId, Dave, Bob);218        await transferFromExpectFail(reFungibleCollectionId, newReFungibleTokenId, Dave, Alice, Charlie, 1);219      } catch (e) {220        // tslint:disable-next-line:no-unused-expression221        expect(e).to.be.exist;222      }223    });224  });225  it( 'transferFrom burnt token before approve NFT', async () => {226    await usingApi(async (api: ApiPromise) => {227      // nft228      const nftCollectionId = await createCollectionExpectSuccess();229      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');230      await burnItemExpectSuccess(Alice, nftCollectionId, newNftTokenId, 1);231      await approveExpectFail(nftCollectionId, newNftTokenId, Alice, Bob);232      await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1);      233    });234  });235  it( 'transferFrom burnt token before approve Fungible', async () => {236    await usingApi(async (api: ApiPromise) => {237      const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});238      const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');239      await burnItemExpectSuccess(Alice, fungibleCollectionId, 1, 10);240      await approveExpectFail(fungibleCollectionId, newFungibleTokenId, Alice, Bob);241      await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, Bob, Alice, Charlie, 1);242          243    });244  }); 245  it( 'transferFrom burnt token before approve ReFungible', async () => {246    await usingApi(async (api: ApiPromise) => {247      const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});248      const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');249      await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 1);250      await approveExpectFail(reFungibleCollectionId, newReFungibleTokenId, Alice, Bob);251      await transferFromExpectFail(reFungibleCollectionId, newReFungibleTokenId, Bob, Alice, Charlie, 1);252          253    });254  });255  256  it( 'transferFrom burnt token after approve NFT', async () => {257    await usingApi(async (api: ApiPromise) => {258      // nft259      const nftCollectionId = await createCollectionExpectSuccess();260      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');261      await approveExpectSuccess(nftCollectionId, newNftTokenId, Alice, Bob);262      await burnItemExpectSuccess(Alice, nftCollectionId, newNftTokenId, 1);263      await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1);      264    });265  });266  it( 'transferFrom burnt token after approve Fungible', async () => {267    await usingApi(async (api: ApiPromise) => {268      const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});269      const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');270      await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, Alice, Bob);271      await burnItemExpectSuccess(Alice, fungibleCollectionId, 1, 10);272      await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, Bob, Alice, Charlie, 1);273          274    });275  }); 276  it( 'transferFrom burnt token after approve ReFungible', async () => {277    await usingApi(async (api: ApiPromise) => {278      const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});279      const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');280      await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, Alice, Bob);281      await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 1);282      await transferFromExpectFail(reFungibleCollectionId, newReFungibleTokenId, Bob, Alice, Charlie, 1);283          284    });285  });286287  it('fails when called by collection owner on non-owned item when OwnerCanTransfer == false', async () => {288    const collectionId = await createCollectionExpectSuccess();289    const itemId = await createItemExpectSuccess(Alice, collectionId, 'NFT', Bob.address);290    await setCollectionLimitsExpectSuccess(Alice, collectionId, { OwnerCanTransfer: false });291292    await transferFromExpectFail(collectionId, itemId, Alice, Bob, Charlie);293  });294});
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -599,8 +599,7 @@
     // tslint:disable-next-line:no-unused-expression
     expect(result.success).to.be.true;
     // tslint:disable-next-line:no-unused-expression
-    expect(item).to.be.not.null;
-    expect(item.Owner).to.be.equal(nullPublicKey);
+    expect(item).to.be.null;
   });
 }
 
@@ -641,16 +640,16 @@
     // tslint:disable-next-line:no-unused-expression
     expect(result.success).to.be.true;
     if (type === 'NFT') {
-      const nftItemData = await api.query.nft.nftItemList(collectionId, tokenId) as unknown as ITokenDataType;
+      const nftItemData = (await api.query.nft.nftItemList(collectionId, tokenId) as any).unwrap() as ITokenDataType;
       expect(nftItemData.Owner.toString()).to.be.equal(accountTo.address);
     }
     if (type === 'Fungible') {
-      const balanceAfter = await api.query.nft.balance(collectionId, accountTo.address) as unknown as BN;
+      const balanceAfter = (await api.query.nft.fungibleItemList(collectionId, accountTo.address) as any).Value as unknown as BN;
       expect(balanceAfter.sub(balanceBefore).toString()).to.be.equal(value.toString());
     }
     if (type === 'ReFungible') {
       const nftItemData =
-        await api.query.nft.reFungibleItemList(collectionId, tokenId) as unknown as IReFungibleTokenDataType;
+        (await api.query.nft.reFungibleItemList(collectionId, tokenId) as any).unwrap() as IReFungibleTokenDataType;
       expect(nftItemData.Owner[0].Owner.toString()).to.be.equal(accountTo.address);
       expect(nftItemData.Owner[0].Fraction.toNumber()).to.be.equal(value);
     }
@@ -697,18 +696,18 @@
     expect(result.recipient).to.be.equal(recipient.address);
     expect(result.value.toString()).to.be.equal(value.toString());
     if (type === 'NFT') {
-      const nftItemData = await api.query.nft.nftItemList(collectionId, tokenId) as unknown as ITokenDataType;
+      const nftItemData = (await api.query.nft.nftItemList(collectionId, tokenId)).toJSON() as unknown as ITokenDataType;
       expect(nftItemData.Owner.toString()).to.be.equal(recipient.address);
     }
     if (type === 'Fungible') {
-      const balanceAfter = await api.query.nft.balance(collectionId, recipient.address) as unknown as BN;
+      const balanceAfter = (await api.query.nft.fungibleItemList(collectionId, recipient.address) as any).Value as unknown as BN;
       expect(balanceAfter.sub(balanceBefore).toString()).to.be.equal(value.toString());
     }
     if (type === 'ReFungible') {
       const nftItemData =
-        await api.query.nft.reFungibleItemList(collectionId, tokenId) as unknown as IReFungibleTokenDataType;
+        (await api.query.nft.reFungibleItemList(collectionId, tokenId)).toJSON() as unknown as IReFungibleTokenDataType;
       expect(nftItemData.Owner[0].Owner.toString()).to.be.equal(recipient.address);
-      expect(nftItemData.Owner[0].Fraction.toNumber()).to.be.equal(value);
+      expect(nftItemData.Owner[0].Fraction.toString()).to.be.equal(value.toString());
     }
   });
 }