git.delta.rocks / unique-network / refs/commits / 196e17086f5d

difftreelog

style(repair) adjust test names + documentation

Fahrrader2022-12-16parent: #c944a0c.patch.diff
in: master

5 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -1223,7 +1223,7 @@
 	}
 
 	/// Set a scoped collection property, where the scope is a special prefix
-	/// prohibiting a user to change the property.
+	/// prohibiting a user access to change the property directly.
 	///
 	/// * `collection_id` - ID of the collection for which the property is being set.
 	/// * `scope` - Property scope.
@@ -1242,7 +1242,7 @@
 	}
 
 	/// Set scoped collection properties, where the scope is a special prefix
-	/// prohibiting a user to change the properties.
+	/// prohibiting a user access to change the properties directly.
 	///
 	/// * `collection_id` - ID of the collection for which the properties is being set.
 	/// * `scope` - Property scope.
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -983,7 +983,7 @@
 			})
 		}
 
-		/// Repairs a collection's properties if the data was somehow corrupted.
+		/// Repairs a collection if the data was somehow corrupted.
 		///
 		/// # Arguments
 		///
@@ -997,7 +997,7 @@
 			<PalletCommon<T>>::repair_collection(collection_id)
 		}
 
-		/// Repairs a token's properties if the data was somehow corrupted.
+		/// Repairs a token if the data was somehow corrupted.
 		///
 		/// # Arguments
 		///
modifiedtests/src/nesting/collectionProperties.seqtest.tsdiffbeforeafterboth
--- a/tests/src/nesting/collectionProperties.seqtest.ts
+++ b/tests/src/nesting/collectionProperties.seqtest.ts
@@ -17,7 +17,7 @@
 import {IKeyringPair} from '@polkadot/types/types';
 import {itSub, Pallets, usingPlaygrounds, expect, requirePalletsOrSkip} from '../util';
 
-describe('Integration Test: Collection Properties', () => {
+describe('Integration Test: Collection Properties with sudo', () => {
   let superuser: IKeyringPair;
   let alice: IKeyringPair;
   
@@ -40,7 +40,7 @@
         requirePalletsOrSkip(this, helper, testSuite.requiredPallets);
       });
     });
-    
+
     itSub('Repairing an unbroken collection\'s properties preserves the consumed space', async({helper}) => {
       const properties = [
         {key: 'sea-creatures', value: 'mermaids'},
modifiedtests/src/nesting/collectionProperties.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/collectionProperties.test.ts
+++ b/tests/src/nesting/collectionProperties.test.ts
@@ -315,7 +315,7 @@
       }
     });
 
-    itSub('Modifying a collection property with different sizes correctly changes the consumed space', async({helper}) => {
+    itSub('Forbids to repair a collection if called with non-sudo', async({helper}) => {
       const collection = await helper[testSuite.mode].mintCollection(alice, {properties: [
         {key: 'sea-creatures', value: 'mermaids'},
         {key: 'goldenratio', value: '1.6180339887498948482045868343656381177203091798057628621354486227052604628189'},
modifiedtests/src/nesting/tokenProperties.seqtest.tsdiffbeforeafterboth
before · tests/src/nesting/tokenProperties.seqtest.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {IKeyringPair} from '@polkadot/types/types';18import {itSub, Pallets, usingPlaygrounds, expect, requirePalletsOrSkip} from '../util';1920describe('Integration Test: Token Properties', () => {21  let superuser: IKeyringPair;22  let alice: IKeyringPair; // collection owner2324  before(async () => {25    await usingPlaygrounds(async (helper, privateKey) => {26      superuser = await privateKey('//Alice');27      const donor = await privateKey({filename: __filename});28      [alice] = await helper.arrange.createAccounts([100n], donor);29    });30  });3132  [33    {mode: 'nft' as const, pieces: undefined, requiredPallets: []},34    {mode: 'rft' as const, pieces: 100n, requiredPallets: [Pallets.ReFungible]}, 35  ].map(testSuite => describe(`${testSuite.mode.toUpperCase()}`, () => {36    before(async function() {37      // eslint-disable-next-line require-await38      await usingPlaygrounds(async helper => {39        requirePalletsOrSkip(this, helper, testSuite.requiredPallets);40      });41    });42    43    itSub('force_repair_item preserves valid consumed space', async({helper}) => {44      const propKey = 'tok-prop';4546      const collection = await helper[testSuite.mode].mintCollection(alice, {47        tokenPropertyPermissions: [48          {49            key: propKey,50            permission: {mutable: true, tokenOwner: true},51          },52        ],53      });54      const token = await (55        testSuite.pieces56          ? collection.mintToken(alice, testSuite.pieces)57          : collection.mintToken(alice)58      );5960      const propDataSize = 4096;61      const propData = 'a'.repeat(propDataSize);6263      await token.setProperties(alice, [{key: propKey, value: propData}]);64      const originalSpace = await token.getTokenPropertiesConsumedSpace();65      expect(originalSpace).to.be.equal(propDataSize);6667      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.unique.forceRepairItem', [token.collectionId, token.tokenId], true);68      const recomputedSpace = await token.getTokenPropertiesConsumedSpace();69      expect(recomputedSpace).to.be.equal(originalSpace);70    });71  }));72});