git.delta.rocks / unique-network / refs/commits / f16723a5aa89

difftreelog

Merge pull request #51 from usetech-llc/feature/NFTPAR-246_remove_sponsor_tests

str-mv2020-12-25parents: #cd29302 #bd903ea.patch.diff
in: master
NFTPAR-246 remove sponsor tests

3 files changed

modifiedtests/src/confirmSponsorship.test.tsdiffbeforeafterboth
32let bob: IKeyringPair;32let bob: IKeyringPair;
33let charlie: IKeyringPair;33let charlie: IKeyringPair;
3434
35describe.only('integration test: ext. confirmSponsorship():', () => {35describe('integration test: ext. confirmSponsorship():', () => {
3636
37 before(async () => {37 before(async () => {
38 await usingApi(async (api) => {38 await usingApi(async (api) => {
299299
300});300});
301301
302describe.only('(!negative test!) integration test: ext. setCollectionSponsor():', () => {302describe('(!negative test!) integration test: ext. removeCollectionSponsor():', () => {
303 before(async () => {303 before(async () => {
304 await usingApi(async (api) => {304 await usingApi(async (api) => {
305 const keyring = new Keyring({ type: 'sr25519' });305 const keyring = new Keyring({ type: 'sr25519' });
addedtests/src/removeCollectionSponsor.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/util/helpers.tsdiffbeforeafterboth
213 });213 });
214}214}
215
216export async function removeCollectionSponsorExpectSuccess(collectionId: number) {
217 await usingApi(async (api) => {
218
219 // Run the transaction
220 const alicePrivateKey = privateKey('//Alice');
221 const tx = api.tx.nft.removeCollectionSponsor(collectionId);
222 const events = await submitTransactionAsync(alicePrivateKey, tx);
223 const result = getGenericResult(events);
224
225 // Get the collection
226 const collection: any = (await api.query.nft.collection(collectionId)).toJSON();
227
228 // What to expect
229 expect(result.success).to.be.true;
230 expect(collection.Sponsor).to.be.equal(nullPublicKey);
231 expect(collection.SponsorConfirmed).to.be.false;
232 });
233}
234
235export async function removeCollectionSponsorExpectFailure(collectionId: number) {
236 await usingApi(async (api) => {
237
238 // Run the transaction
239 const alicePrivateKey = privateKey('//Alice');
240 const tx = api.tx.nft.removeCollectionSponsor(collectionId);
241 const events = await submitTransactionAsync(alicePrivateKey, tx);
242 const result = getGenericResult(events);
243
244 // What to expect
245 expect(result.success).to.be.false;
246 });
247}
215248
216export async function setCollectionSponsorExpectFailure(collectionId: number, sponsor: string, senderSeed: string = '//Alice') {249export async function setCollectionSponsorExpectFailure(collectionId: number, sponsor: string, senderSeed: string = '//Alice') {
217 await usingApi(async (api) => {250 await usingApi(async (api) => {