git.delta.rocks / unique-network / refs/commits / 83994a56b4ab

difftreelog

New test added

str-mv2021-08-13parent: #6b16ace.patch.diff
in: master

1 file changed

modifiedtests/src/change-collection-owner.test.tsdiffbeforeafterboth
21 enableWhiteListExpectFail,21 enableWhiteListExpectFail,
22 setMintPermissionExpectFailure,22 setMintPermissionExpectFailure,
23 destroyCollectionExpectFailure,23 destroyCollectionExpectFailure,
24 setPublicAccessModeExpectSuccess,
24} from './util/helpers';25} from './util/helpers';
2526
26chai.use(chaiAsPromised);27chai.use(chaiAsPromised);
103 );104 );
104 await submitTransactionAsync(bob, tx1);105 await submitTransactionAsync(bob, tx1);
105106
107 await setPublicAccessModeExpectSuccess(bob, collectionId, 'WhiteList');
106 await enableWhiteListExpectSuccess(bob, collectionId);108 await enableWhiteListExpectSuccess(bob, collectionId);
107 await setMintPermissionExpectSuccess(bob, collectionId, true);109 await setMintPermissionExpectSuccess(bob, collectionId, true);
108 await destroyCollectionExpectSuccess(collectionId, '//Bob');110 await destroyCollectionExpectSuccess(collectionId, '//Bob');
109 });111 });
110 });112 });
113
114 it('New collectionOwner has access to changeCollectionOwner', async () => {
115 await usingApi(async api => {
116 const collectionId = await createCollectionExpectSuccess();
117 const alice = privateKey('//Alice');
118 const bob = privateKey('//Bob');
119 const charlie = privateKey('//Charlie');
120
121 const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();
122 expect(collection.Owner).to.be.deep.eq(alice.address);
123
124 const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);
125 await submitTransactionAsync(alice, changeOwnerTx);
126
127 const collectionAfterOwnerChange: any = (await api.query.nft.collectionById(collectionId)).toJSON();
128 expect(collectionAfterOwnerChange.Owner).to.be.deep.eq(bob.address);
129
130 const changeOwnerTx2 = api.tx.nft.changeCollectionOwner(collectionId, charlie.address);
131 await submitTransactionAsync(bob, changeOwnerTx2);
132
133 // ownership lost
134 const collectionAfterOwnerChange2: any = (await api.query.nft.collectionById(collectionId)).toJSON();
135 expect(collectionAfterOwnerChange2.Owner).to.be.deep.eq(charlie.address);
136 });
137 });
111});138});
112139
113describe('Negative Integration Test changeCollectionOwner(collection_id, new_owner):', () => {140describe('Negative Integration Test changeCollectionOwner(collection_id, new_owner):', () => {