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

difftreelog

source

tests/src/collision-tests/setSponsorNewOwner.test.ts1.6 KiBsourcehistory
1import { IKeyringPair } from '@polkadot/types/types';2import chai from 'chai';3import chaiAsPromised from 'chai-as-promised';4import privateKey from '../substrate/privateKey';5import usingApi from '../substrate/substrate-api';6import {7  createCollectionExpectSuccess, 8  setCollectionSponsorExpectSuccess,9  waitNewBlocks,10} from '../util/helpers';1112chai.use(chaiAsPromised);13const expect = chai.expect;14let Alice: IKeyringPair;15let Bob: IKeyringPair;16let Ferdie: IKeyringPair;1718before(async () => {19  await usingApi(async () => {20    Alice = privateKey('//Alice');21    Bob = privateKey('//Bob');22    Ferdie = privateKey('//Ferdie');23  });24});2526describe('Sponsored with new owner ', () => {27  // tslint:disable-next-line: max-line-length28  it('Confirmation of sponsorship of a collection in a block with a change in the owner of the collection: ', async () => {29    await usingApi(async (api) => {30      const collectionId = await createCollectionExpectSuccess();31      await setCollectionSponsorExpectSuccess(collectionId, Bob.address);32      await waitNewBlocks(2);33      const confirmSponsorship = api.tx.nft.confirmSponsorship(collectionId);34      const changeCollectionOwner = api.tx.nft.changeCollectionOwner(collectionId, Ferdie.address);35      await Promise.all([36        confirmSponsorship.signAndSend(Bob),37        changeCollectionOwner.signAndSend(Alice),38      ]);39      await waitNewBlocks(2);40      const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();41      expect(collection.Sponsorship.confirmed).to.be.eq(Bob.address);42      expect(collection.Owner).to.be.eq(Ferdie.address);43      await waitNewBlocks(2);44    });45  });46});