difftreelog
cannot delete prop of non-owned collections
in: master
1 file changed
tests/src/eth/collectionProperties.test.tsdiffbeforeafterboth72 {method: 'deleteCollectionProperties', methodParams: [['testKey1', 'testKey2']], expectedProps: [{key: 'testKey3', value: 'testValue3'}]},72 {method: 'deleteCollectionProperties', methodParams: [['testKey1', 'testKey2']], expectedProps: [{key: 'testKey3', value: 'testValue3'}]},73 {method: 'deleteCollectionProperty', methodParams: ['testKey1'], expectedProps: [{key: 'testKey2', value: 'testValue2'}, {key: 'testKey3', value: 'testValue3'}]}, 73 {method: 'deleteCollectionProperty', methodParams: ['testKey1'], expectedProps: [{key: 'testKey2', value: 'testValue2'}, {key: 'testKey3', value: 'testValue3'}]}, 74 ].map(testCase => 74 ].map(testCase => 75 itEth(`Collection properties can be deleted: ${testCase.method}`, async({helper}) => {75 itEth(`Collection properties can be deleted: ${testCase.method}()`, async({helper}) => {76 const properties = [76 const properties = [77 {key: 'testKey1', value: 'testValue1'},77 {key: 'testKey1', value: 'testValue1'},78 {key: 'testKey2', value: 'testValue2'},78 {key: 'testKey2', value: 'testValue2'},93 expect(raw.properties).to.deep.equal(testCase.expectedProps);93 expect(raw.properties).to.deep.equal(testCase.expectedProps);94 }));94 }));95 9596 // TODO cannot delete non-existing props and props of non-owned collections96 97 [98 {method: 'deleteCollectionProperties', methodParams: [['testKey2']]},99 {method: 'deleteCollectionProperty', methodParams: ['testKey2']},100 ].map(testCase => 101 itEth(`cannot ${testCase.method}() of non-owned collections`, async ({helper}) => {102 const properties = [103 {key: 'testKey1', value: 'testValue1'},104 {key: 'testKey2', value: 'testValue2'},105 ];106 const caller = await helper.eth.createAccountWithBalance(donor);107 const collection = await helper.nft.mintCollection(alice, {name: 'name', description: 'test', tokenPrefix: 'test', properties});108109 const address = helper.ethAddress.fromCollectionId(collection.collectionId);110 const collectionEvm = helper.ethNativeContract.collection(address, 'nft', caller, testCase.method === 'deleteCollectionProperty');111112 await expect(collectionEvm.methods[testCase.method](...testCase.methodParams).send({from: caller})).to.be.rejected;113 expect(await collection.getProperties()).to.deep.eq(properties);114 }));9711598 itEth('Can be read', async({helper}) => {116 itEth('Can be read', async({helper}) => {99 const caller = helper.eth.createAccount();117 const caller = helper.eth.createAccount();