git.delta.rocks / unique-network / refs/commits / 764dfd599fff

difftreelog

Quick fix for nesting tests

Andrey Kuznetsov2022-05-29parent: #e4d7343.patch.diff
in: master

5 files changed

modifiedtests/src/nesting/graphs.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/graphs.test.ts
+++ b/tests/src/nesting/graphs.test.ts
@@ -14,7 +14,7 @@
  * ```
  */
 async function buildComplexObjectGraph(api: ApiPromise, sender: IKeyringPair): Promise<number> {
-  const events = await executeTransaction(api, sender, api.tx.unique.createCollectionEx({mode: 'NFT', limits: {nestingRule: 'Owner'}}));
+  const events = await executeTransaction(api, sender, api.tx.unique.createCollectionEx({mode: 'NFT', permissions: {nesting: 'Owner'}}));
   const {collectionId} = getCreateCollectionResult(events);
 
   await executeTransaction(api, sender, api.tx.unique.createMultipleItemsEx(collectionId, {NFT: Array(8).fill({owner: {Substrate: sender.address}})}));
modifiedtests/src/nesting/nest.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/nest.test.ts
+++ b/tests/src/nesting/nest.test.ts
@@ -8,11 +8,11 @@
   createItemExpectSuccess,
   enableAllowListExpectSuccess,
   enablePublicMintingExpectSuccess,
-  getTokenOwner, 
+  getTokenOwner,
   getTopmostTokenOwner,
-  setCollectionLimitsExpectSuccess, 
-  transferExpectFailure, 
-  transferExpectSuccess, 
+  setCollectionPermissionsExceptSuccess,
+  transferExpectFailure,
+  transferExpectSuccess,
   transferFromExpectSuccess,
 } from '../util/helpers';
 import {IKeyringPair} from '@polkadot/types/types';
@@ -31,7 +31,7 @@
   it('Performs the full suite: bundles a token, transfers, and allows to unnest', async () => {
     await usingApi(async api => {
       const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+      await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
       const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
 
       // Create a nested token
@@ -63,7 +63,7 @@
   it('NFT: allows an Owner to nest/unnest their token', async () => {
     await usingApi(async api => {
       const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+      await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
       const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
 
       // Create a nested token
@@ -82,7 +82,7 @@
   it('NFT: allows an Owner to nest/unnest their token (Restricted nesting)', async () => {
     await usingApi(async api => {
       const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: {OwnerRestricted:[collection]}});
+      await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: {OwnerRestricted:[collection]}});
       const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
 
       // Create a nested token
@@ -103,7 +103,7 @@
   it('Fungible: allows an Owner to nest/unnest their token', async () => {
     await usingApi(async api => {
       const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: 'Owner'});
+      await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: 'Owner'});
       const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT', {Substrate: alice.address});
       const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
 
@@ -130,7 +130,7 @@
 
       const collectionFT = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
 
-      await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: {OwnerRestricted:[collectionFT]}});
+      await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: {OwnerRestricted: [collectionFT]}});
 
       // Create a nested token
       await expect(executeTransaction(api, alice, api.tx.unique.createItem(
@@ -150,7 +150,7 @@
   it('ReFungible: allows an Owner to nest/unnest their token', async () => {
     await usingApi(async api => {
       const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: 'Owner'});
+      await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: 'Owner'});
       const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT', {Substrate: alice.address});
       const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
 
@@ -177,7 +177,7 @@
 
       const collectionRFT = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
 
-      await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: {OwnerRestricted:[collectionRFT]}});
+      await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: {OwnerRestricted:[collectionRFT]}});
 
       // Create a nested token
       await expect(executeTransaction(api, alice, api.tx.unique.createItem(
@@ -204,7 +204,7 @@
   it('Disallows excessive token nesting', async () => {
     await usingApi(async api => {
       const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+      await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
       const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
 
       // Create a nested-token matryoshka
@@ -226,7 +226,7 @@
   it('NFT: disallows to nest token if nesting is disabled', async () => {
     await usingApi(async api => {
       const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Disabled'});
+      await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Disabled'});
       const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
 
       // Try to create a nested token
@@ -248,7 +248,7 @@
   it('NFT: disallows a non-Owner to nest someone else\'s token', async () => {
     await usingApi(async api => {
       const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+      await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
 
       await addToAllowListExpectSuccess(alice, collection, bob.address);
       await enableAllowListExpectSuccess(alice, collection);
@@ -274,7 +274,7 @@
   it('NFT: disallows a non-Owner to nest someone else\'s token (Restricted nesting)', async () => {
     await usingApi(async api => {
       const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: {OwnerRestricted:[collection]}});
+      await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: {OwnerRestricted:[collection]}});
 
       await addToAllowListExpectSuccess(alice, collection, bob.address);
       await enableAllowListExpectSuccess(alice, collection);
@@ -300,7 +300,7 @@
   it('NFT: disallows to nest token in an unlisted collection', async () => {
     await usingApi(async api => {
       const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: {OwnerRestricted:[]}});
+      await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: {OwnerRestricted:[]}});
 
       // Create a token to attempt to be nested into
       const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
@@ -324,7 +324,7 @@
   it('Fungible: disallows to nest token if nesting is disabled', async () => {
     await usingApi(async api => {
       const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: 'Disabled'});
+      await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: 'Disabled'});
       const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');
       const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
 
@@ -352,7 +352,7 @@
   it('Fungible: disallows a non-Owner to nest someone else\'s token', async () => {
     await usingApi(async api => {
       const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: 'Owner'});
+      await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: 'Owner'});
 
       await addToAllowListExpectSuccess(alice, collectionNFT, bob.address);
       await enableAllowListExpectSuccess(alice, collectionNFT);
@@ -389,7 +389,7 @@
       const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
 
       const collectionFT = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
-      await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: {OwnerRestricted:[collectionFT]}});
+      await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: {OwnerRestricted:[collectionFT]}});
 
       // Try to create a nested token in the wrong collection
       await expect(executeTransaction(api, alice, api.tx.unique.createItem(
@@ -407,7 +407,7 @@
   it('Fungible: disallows to nest token in an unlisted collection', async () => {
     await usingApi(async api => {
       const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: {OwnerRestricted:[]}});
+      await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: {OwnerRestricted:[]}});
 
       // Create a token to attempt to be nested into
       const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');
@@ -433,7 +433,7 @@
   it('ReFungible: disallows to nest token if nesting is disabled', async () => {
     await usingApi(async api => {
       const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: 'Disabled'});
+      await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: 'Disabled'});
       const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');
       const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
 
@@ -463,7 +463,7 @@
   it('ReFungible: disallows a non-Owner to nest someone else\'s token', async () => {
     await usingApi(async api => {
       const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: 'Owner'});
+      await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: 'Owner'});
 
       await addToAllowListExpectSuccess(alice, collectionNFT, bob.address);
       await enableAllowListExpectSuccess(alice, collectionNFT);
@@ -500,7 +500,7 @@
       const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
 
       const collectionRFT = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-      await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: {OwnerRestricted:[collectionRFT]}});
+      await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: {OwnerRestricted:[collectionRFT]}});
 
       // Try to create a nested token in the wrong collection
       await expect(executeTransaction(api, alice, api.tx.unique.createItem(
@@ -518,7 +518,7 @@
   it('ReFungible: disallows to nest token to an unlisted collection', async () => {
     await usingApi(async api => {
       const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: {OwnerRestricted:[]}});
+      await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: {OwnerRestricted:[]}});
 
       // Create a token to attempt to be nested into
       const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');
modifiedtests/src/nesting/rules-smoke.test.tsdiffbeforeafterboth
before · tests/src/nesting/rules-smoke.test.ts
1import {expect} from 'chai';2import {tokenIdToAddress} from '../eth/util/helpers';3import privateKey from '../substrate/privateKey';4import usingApi, {executeTransaction} from '../substrate/substrate-api';5import {createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, CrossAccountId, getCreateCollectionResult} from '../util/helpers';6import {IKeyringPair} from '@polkadot/types/types';78describe('nesting check', () => {9  let alice!: IKeyringPair;10  let nestTarget!: CrossAccountId;11  before(async() => {12    await usingApi(async api => {13      alice = privateKey('//Alice');14      const bob = privateKey('//Bob');15      const events = await executeTransaction(api, alice, api.tx.unique.createCollectionEx({16        mode: 'NFT',17        limits: {18          nestingRule: {OwnerRestricted: []},19        },20      }));21      const collection = getCreateCollectionResult(events).collectionId;22      const token = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: bob.address});23      nestTarget = {Ethereum: tokenIdToAddress(collection, token)};24    });25  });2627  it('called for fungible', async () => {28    await usingApi(async api => {29      const collection = await createCollectionExpectSuccess({mode: {type: 'Fungible',decimalPoints:0}});30      await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {Fungible: {Value: 1}})))31        .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);3233      await createFungibleItemExpectSuccess(alice, collection, {Value:1n}, {Substrate: alice.address});34      await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, 0, 1n)))35        .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);36    });37  });3839  it('called for nonfungible', async () => {40    await usingApi(async api => {41      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});42      await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {NFT: {ConstData: []}})))43        .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);4445      const token = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});46      await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, token, 1n)))47        .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);48    });49  });5051  it('called for refungible', async () => {52    await usingApi(async api => {53      const collection = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});54      await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {ReFungible: {ConstData: []}})))55        .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);5657      const token = await createItemExpectSuccess(alice, collection, 'ReFungible', {Substrate: alice.address});58      await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, token, 1n)))59        .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);60    });61  });62});
after · tests/src/nesting/rules-smoke.test.ts
1import {expect} from 'chai';2import {tokenIdToAddress} from '../eth/util/helpers';3import privateKey from '../substrate/privateKey';4import usingApi, {executeTransaction} from '../substrate/substrate-api';5import {createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, CrossAccountId, getCreateCollectionResult} from '../util/helpers';6import {IKeyringPair} from '@polkadot/types/types';78describe('nesting check', () => {9  let alice!: IKeyringPair;10  let nestTarget!: CrossAccountId;11  before(async() => {12    await usingApi(async api => {13      alice = privateKey('//Alice');14      const bob = privateKey('//Bob');15      const events = await executeTransaction(api, alice, api.tx.unique.createCollectionEx({16        mode: 'NFT',17        permissions: {18          nesting: {OwnerRestricted: []},19        },20      }));21      const collection = getCreateCollectionResult(events).collectionId;22      const token = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: bob.address});23      nestTarget = {Ethereum: tokenIdToAddress(collection, token)};24    });25  });2627  it('called for fungible', async () => {28    await usingApi(async api => {29      const collection = await createCollectionExpectSuccess({mode: {type: 'Fungible',decimalPoints:0}});30      await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {Fungible: {Value: 1}})))31        .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);3233      await createFungibleItemExpectSuccess(alice, collection, {Value:1n}, {Substrate: alice.address});34      await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, 0, 1n)))35        .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);36    });37  });3839  it('called for nonfungible', async () => {40    await usingApi(async api => {41      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});42      await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {NFT: {properties: []}})))43        .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);4445      const token = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});46      await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, token, 1n)))47        .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);48    });49  });5051  it('called for refungible', async () => {52    await usingApi(async api => {53      const collection = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});54      await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {ReFungible: {}})))55        .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);5657      const token = await createItemExpectSuccess(alice, collection, 'ReFungible', {Substrate: alice.address});58      await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, token, 1n)))59        .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);60    });61  });62});
modifiedtests/src/nesting/unnest.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/unnest.test.ts
+++ b/tests/src/nesting/unnest.test.ts
@@ -8,7 +8,7 @@
   getBalance,
   getTokenOwner,
   normalizeAccountId,
-  setCollectionLimitsExpectSuccess,
+  setCollectionPermissionsExceptSuccess,
   transferExpectSuccess,
   transferFromExpectSuccess,
 } from '../util/helpers';
@@ -28,7 +28,7 @@
   it('NFT: allows the owner to successfully unnest a token', async () => {
     await usingApi(async api => {
       const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+      await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
       const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
       const targetAddress = {Ethereum: tokenIdToAddress(collection, targetToken)};
 
@@ -57,7 +57,7 @@
   it('Fungible: allows the owner to successfully unnest a token', async () => {
     await usingApi(async api => {
       const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+      await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
       const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
       const targetAddress = {Ethereum: tokenIdToAddress(collection, targetToken)};
 
@@ -84,7 +84,7 @@
   it('ReFungible: allows the owner to successfully unnest a token', async () => {
     await usingApi(async api => {
       const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+      await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
       const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
       const targetAddress = {Ethereum: tokenIdToAddress(collection, targetToken)};
 
@@ -119,7 +119,7 @@
   it('Disallows a non-owner to unnest/burn a token', async () => {
     await usingApi(async api => {
       const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+      await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
       const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
       const targetAddress = {Ethereum: tokenIdToAddress(collection, targetToken)};
 
@@ -149,7 +149,7 @@
   // Recursive nesting
   it('Prevents Ouroboros creation', async () => {
     const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-    await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+    await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
     const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
 
     // Create a nested token ouroboros
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -325,7 +325,7 @@
 };
 
 export async function createCollectionExpectSuccess(params: Partial<CreateCollectionParams> = {}): Promise<number> {
-  const {name, description, mode, tokenPrefix, schemaVersion} = {...defaultCreateCollectionParams, ...params};
+  const {name, description, mode, tokenPrefix} = {...defaultCreateCollectionParams, ...params};
 
   let collectionId = 0;
   await usingApi(async (api) => {
@@ -348,8 +348,7 @@
       name: strToUTF16(name),
       description: strToUTF16(description),
       tokenPrefix: strToUTF16(tokenPrefix),
-      mode: modeprm as any,
-      schemaVersion: schemaVersion,
+      mode: modeprm as any
     });
     const events = await submitTransactionAsync(alicePrivateKey, tx);
     const result = getCreateCollectionResult(events);
@@ -555,6 +554,16 @@
   });
 }
 
+export const setCollectionPermissionsExceptSuccess = async (sender: IKeyringPair, collectionId: number, permissions: {mintMode?: boolean, access?: 'Normal' | 'AllowList', nesting?: 'Disabled' | 'Owner' | {OwnerRestricted: number[]}}) => {
+  await usingApi(async(api) => {
+    const tx = api.tx.unique.setCollectionPermissions(collectionId, permissions);
+    const events = await submitTransactionAsync(sender, tx);
+    const result = getGenericResult(events);
+
+    expect(result.success).to.be.true;
+  });
+}
+
 export async function setCollectionLimitsExpectFailure(sender: IKeyringPair, collectionId: number, limits: any) {
   await usingApi(async (api) => {
     const tx = api.tx.unique.setCollectionLimits(collectionId, limits);
@@ -1299,7 +1308,7 @@
     // What to expect
     // tslint:disable-next-line:no-unused-expression
     expect(result.success).to.be.true;
-    expect(collection.access.toHuman()).to.be.equal(accessMode);
+    expect(collection.permissions.access.toHuman()).to.be.equal(accessMode);
   });
 }
 
@@ -1344,7 +1353,7 @@
     // Get the collection
     const collection = await queryCollectionExpectSuccess(api, collectionId);
 
-    expect(collection.mintMode.toHuman()).to.be.equal(enabled);
+    expect(collection.permissions.mintMode.toHuman()).to.be.equal(enabled);
   });
 }