difftreelog
deleteCollectionProperties multiple properties case
in: master
+ combine with deleteCollectionProperty
1 file changed
tests/src/eth/collectionProperties.test.tsdiffbeforeafterboth50 }));50 }));5151525253 // Soft-deprecated: deleteCollectionProperty54 [{method: 'deleteCollectionProperties', methodParams: [['testKey1', 'testKey2']], expectedProps: [{key: 'testKey3', value: 'testValue3'}]},55 {method: 'deleteCollectionProperty', methodParams: ['testKey1'], expectedProps: [{key: 'testKey2', value: 'testValue2'}, {key: 'testKey3', value: 'testValue3'}]}, 56 ].map(testCase => 53 itEth('Can be deleted', async({helper}) => {57 itEth(`Collection properties can be deleted: ${testCase.method}`, async({helper}) => {58 const properties = [59 {key: 'testKey1', value: 'testValue1'},60 {key: 'testKey2', value: 'testValue2'},61 {key: 'testKey3', value: 'testValue3'}];54 const caller = await helper.eth.createAccountWithBalance(donor);62 const caller = await helper.eth.createAccountWithBalance(donor);55 const collection = await helper.nft.mintCollection(alice, {name: 'name', description: 'test', tokenPrefix: 'test', properties: [{key: 'testKey', value: 'testValue'}]});63 const collection = await helper.nft.mintCollection(alice, {name: 'name', description: 'test', tokenPrefix: 'test', properties});5664 57 await collection.addAdmin(alice, {Ethereum: caller});65 await collection.addAdmin(alice, {Ethereum: caller});5866 59 const address = helper.ethAddress.fromCollectionId(collection.collectionId);67 const address = helper.ethAddress.fromCollectionId(collection.collectionId);60 const contract = helper.ethNativeContract.collection(address, 'nft', caller);68 const contract = helper.ethNativeContract.collection(address, 'nft', caller, testCase.method === 'deleteCollectionProperty');6169 62 await contract.methods.deleteCollectionProperties(['testKey']).send({from: caller});70 await contract.methods[testCase.method](...testCase.methodParams).send({from: caller});6371 64 const raw = (await collection.getData())?.raw;72 const raw = (await collection.getData())?.raw;6573 66 expect(raw.properties.length).to.equal(0);74 expect(raw.properties.length).to.equal(testCase.expectedProps.length);75 expect(raw.properties).to.deep.equal(testCase.expectedProps);67 });76 }));687769 itEth('Can be read', async({helper}) => {78 itEth('Can be read', async({helper}) => {70 const caller = helper.eth.createAccount();79 const caller = helper.eth.createAccount();77 expect(value).to.equal(helper.getWeb3().utils.toHex('testValue'));86 expect(value).to.equal(helper.getWeb3().utils.toHex('testValue'));78 });87 });7980 // Soft-deprecated81 itEth('Collection property can be deleted', async({helper}) => {82 const caller = await helper.eth.createAccountWithBalance(donor);83 const collection = await helper.nft.mintCollection(alice, {name: 'name', description: 'test', tokenPrefix: 'test', properties: [{key: 'testKey', value: 'testValue'}]});8485 await collection.addAdmin(alice, {Ethereum: caller});8687 const address = helper.ethAddress.fromCollectionId(collection.collectionId);88 const contract = helper.ethNativeContract.collection(address, 'nft', caller, true);8990 await contract.methods.deleteCollectionProperty('testKey').send({from: caller});9192 const raw = (await collection.getData())?.raw;9394 expect(raw.properties.length).to.equal(0);95 });96});88});978998describe('Supports ERC721Metadata', () => {90describe('Supports ERC721Metadata', () => {