git.delta.rocks / unique-network / refs/commits / 4d3b24fb930e

difftreelog

source

tests/src/collision-tests/setSponsorNewOwner.test.ts1.8 KiBsourcehistory
1/* broken by design2// substrate transactions are sequential, not parallel3// the order of execution is indeterminate45import { IKeyringPair } from '@polkadot/types/types';6import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';8import privateKey from '../substrate/privateKey';9import usingApi from '../substrate/substrate-api';10import {11  createCollectionExpectSuccess,12  setCollectionSponsorExpectSuccess,13  waitNewBlocks,14} from '../util/helpers';1516chai.use(chaiAsPromised);17const expect = chai.expect;18let Alice: IKeyringPair;19let Bob: IKeyringPair;20let Ferdie: IKeyringPair;2122before(async () => {23  await usingApi(async () => {24    Alice = privateKey('//Alice');25    Bob = privateKey('//Bob');26    Ferdie = privateKey('//Ferdie');27  });28});2930describe('Sponsored with new owner ', () => {31  // tslint:disable-next-line: max-line-length32  it('Confirmation of sponsorship of a collection in a block with a change in the owner of the collection: ', async () => {33    await usingApi(async (api) => {34      const collectionId = await createCollectionExpectSuccess();35      await setCollectionSponsorExpectSuccess(collectionId, Bob.address);36      await waitNewBlocks(2);37      const confirmSponsorship = api.tx.unique.confirmSponsorship(collectionId);38      const changeCollectionOwner = api.tx.unique.changeCollectionOwner(collectionId, Ferdie.address);39      await Promise.all([40        confirmSponsorship.signAndSend(Bob),41        changeCollectionOwner.signAndSend(Alice),42      ]);43      await waitNewBlocks(2);44      const collection: any = (await api.query.unique.collectionById(collectionId)).toJSON();45      expect(collection.sponsorship.confirmed).to.be.eq(Bob.address);46      expect(collection.owner).to.be.eq(Ferdie.address);47      await waitNewBlocks(2);48    });49  });50});51*/