git.delta.rocks / unique-network / refs/commits / 466af4ed6458

difftreelog

test(properties) RPC collectionById supplies necessary fields

Fahrrader2022-05-20parent: #f6a52db.patch.diff
in: master

1 file changed

modifiedtests/src/nesting/properties.test.tsdiffbeforeafterboth
14let bob: IKeyringPair;14let bob: IKeyringPair;
15let charlie: IKeyringPair;15let charlie: IKeyringPair;
16
17describe('Composite Properties Test', () => {
18 before(async () => {
19 await usingApi(async () => {
20 alice = privateKey('//Alice');
21 bob = privateKey('//Bob');
22 });
23 });
24
25 it('Makes sure collectionById supplies required fields', async () => {
26 await usingApi(async api => {
27 const collectionId = await createCollectionExpectSuccess();
28
29 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;
34
35 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;
44
45 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;
54
55 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});
1661
17// ---------- COLLECTION PROPERTIES62// ---------- COLLECTION PROPERTIES
1863