git.delta.rocks / unique-network / refs/commits / 2b9fe52ee469

difftreelog

source

tests/src/.outdated/collision-tests/setSponsorNewOwner.test.ts2.5 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617/* broken by design18// substrate transactions are sequential, not parallel19// the order of execution is indeterminate2021import { IKeyringPair } from '@polkadot/types/types';22import chai from 'chai';23import chaiAsPromised from 'chai-as-promised';24import privateKey from '../substrate/privateKey';25import usingApi from '../substrate/substrate-api';26import {27  createCollectionExpectSuccess,28  setCollectionSponsorExpectSuccess,29  waitNewBlocks,30} from '../util/helpers';3132chai.use(chaiAsPromised);33const expect = chai.expect;34let Alice: IKeyringPair;35let Bob: IKeyringPair;36let Ferdie: IKeyringPair;3738before(async () => {39  await usingApi(async () => {40    Alice = privateKey('//Alice');41    Bob = privateKey('//Bob');42    Ferdie = privateKey('//Ferdie');43  });44});4546describe('Sponsored with new owner ', () => {47  // tslint:disable-next-line: max-line-length48  it('Confirmation of sponsorship of a collection in a block with a change in the owner of the collection: ', async () => {49    await usingApi(async (api) => {50      const collectionId = await createCollectionExpectSuccess();51      await setCollectionSponsorExpectSuccess(collectionId, Bob.address);52      await waitNewBlocks(2);53      const confirmSponsorship = api.tx.unique.confirmSponsorship(collectionId);54      const changeCollectionOwner = api.tx.unique.changeCollectionOwner(collectionId, Ferdie.address);55      await Promise.all([56        confirmSponsorship.signAndSend(Bob),57        changeCollectionOwner.signAndSend(Alice),58      ]);59      await waitNewBlocks(2);60      const collection: any = (await api.query.unique.collectionById(collectionId)).toJSON();61      expect(collection.sponsorship.confirmed).to.be.eq(Bob.address);62      expect(collection.owner).to.be.eq(Ferdie.address);63      await waitNewBlocks(2);64    });65  });66});67*/