difftreelog
test(properties) RPC collectionById supplies necessary fields
in: master
1 file changed
tests/src/nesting/properties.test.tsdiffbeforeafterboth14let bob: IKeyringPair;14let bob: IKeyringPair;15let charlie: IKeyringPair;15let charlie: IKeyringPair;1617describe('Composite Properties Test', () => {18 before(async () => {19 await usingApi(async () => {20 alice = privateKey('//Alice');21 bob = privateKey('//Bob');22 });23 });2425 it('Makes sure collectionById supplies required fields', async () => {26 await usingApi(async api => {27 const collectionId = await createCollectionExpectSuccess();2829 const collectionOption = await api.rpc.unique.collectionById(collectionId);30 expect(collectionOption.isSome).to.be.true;31 let collection = collectionOption.unwrap();32 expect(collection.tokenPropertyPermissions.toHuman()).to.be.empty;33 expect(collection.properties.toHuman()).to.be.empty;3435 const propertyPermissions = [36 {key: 'mindgame', permission: {collectionAdmin: true, mutable: false, tokenOwner: true}},37 {key: 'skullduggery', permission: {collectionAdmin: false, mutable: true, tokenOwner: false}},38 ];39 await expect(executeTransaction(40 api, 41 alice, 42 api.tx.unique.setPropertyPermissions(collectionId, propertyPermissions), 43 )).to.not.be.rejected;4445 const collectionProperties = [46 {key: 'black_hole', value: 'LIGO'},47 {key: 'electron', value: 'come bond'}, 48 ];49 await expect(executeTransaction(50 api, 51 alice, 52 api.tx.unique.setCollectionProperties(collectionId, collectionProperties), 53 )).to.not.be.rejected;5455 collection = (await api.rpc.unique.collectionById(collectionId)).unwrap();56 expect(collection.tokenPropertyPermissions.toHuman()).to.be.deep.equal(propertyPermissions);57 expect(collection.properties.toHuman()).to.be.deep.equal(collectionProperties);58 });59 });60});166117// ---------- COLLECTION PROPERTIES62// ---------- COLLECTION PROPERTIES1863