difftreelog
style(repair) adjust test names + documentation
in: master
5 files changed
pallets/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.
pallets/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
///
tests/src/nesting/collectionProperties.seqtest.tsdiffbeforeafterboth1// 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: Collection Properties', () => {21 let superuser: IKeyringPair;22 let alice: IKeyringPair;23 24 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, requiredPallets: []},34 {mode: 'ft' as const, requiredPallets: []},35 {mode: 'rft' as const, requiredPallets: [Pallets.ReFungible]}, 36 ].map(testSuite => describe(`${testSuite.mode.toUpperCase()}`, () => {37 before(async function() {38 // eslint-disable-next-line require-await39 await usingPlaygrounds(async helper => {40 requirePalletsOrSkip(this, helper, testSuite.requiredPallets);41 });42 });43 44 itSub('Repairing an unbroken collection\'s properties preserves the consumed space', async({helper}) => {45 const properties = [46 {key: 'sea-creatures', value: 'mermaids'},47 {key: 'goldenratio', value: '1.6180339887498948482045868343656381177203091798057628621354486227052604628189'},48 ];49 const collection = await helper[testSuite.mode].mintCollection(alice, {properties});5051 const newProperty = ' '.repeat(4096);52 await collection.setProperties(alice, [{key: 'space', value: newProperty}]);53 const originalSpace = await collection.getPropertiesConsumedSpace();54 expect(originalSpace).to.be.equal(properties[0].value.length + properties[1].value.length + newProperty.length);5556 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.unique.forceRepairCollection', [collection.collectionId], true);57 const recomputedSpace = await collection.getPropertiesConsumedSpace();58 expect(recomputedSpace).to.be.equal(originalSpace);59 });60 }));61});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: Collection Properties with sudo', () => {21 let superuser: IKeyringPair;22 let alice: IKeyringPair;23 24 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, requiredPallets: []},34 {mode: 'ft' as const, requiredPallets: []},35 {mode: 'rft' as const, requiredPallets: [Pallets.ReFungible]}, 36 ].map(testSuite => describe(`${testSuite.mode.toUpperCase()}`, () => {37 before(async function() {38 // eslint-disable-next-line require-await39 await usingPlaygrounds(async helper => {40 requirePalletsOrSkip(this, helper, testSuite.requiredPallets);41 });42 });4344 itSub('Repairing an unbroken collection\'s properties preserves the consumed space', async({helper}) => {45 const properties = [46 {key: 'sea-creatures', value: 'mermaids'},47 {key: 'goldenratio', value: '1.6180339887498948482045868343656381177203091798057628621354486227052604628189'},48 ];49 const collection = await helper[testSuite.mode].mintCollection(alice, {properties});5051 const newProperty = ' '.repeat(4096);52 await collection.setProperties(alice, [{key: 'space', value: newProperty}]);53 const originalSpace = await collection.getPropertiesConsumedSpace();54 expect(originalSpace).to.be.equal(properties[0].value.length + properties[1].value.length + newProperty.length);5556 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.unique.forceRepairCollection', [collection.collectionId], true);57 const recomputedSpace = await collection.getPropertiesConsumedSpace();58 expect(recomputedSpace).to.be.equal(originalSpace);59 });60 }));61});tests/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'},
tests/src/nesting/tokenProperties.seqtest.tsdiffbeforeafterboth--- a/tests/src/nesting/tokenProperties.seqtest.ts
+++ b/tests/src/nesting/tokenProperties.seqtest.ts
@@ -17,7 +17,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, Pallets, usingPlaygrounds, expect, requirePalletsOrSkip} from '../util';
-describe('Integration Test: Token Properties', () => {
+describe('Integration Test: Token Properties with sudo', () => {
let superuser: IKeyringPair;
let alice: IKeyringPair; // collection owner