difftreelog
Fix tests for quartz and unique: remove global before
in: master
2 files changed
tests/src/adminTransferAndBurn.test.tsdiffbeforeafterboth1// 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/>.1617import {IKeyringPair} from '@polkadot/types/types';18import chai from 'chai';19import chaiAsPromised from 'chai-as-promised';20import {usingPlaygrounds} from './util/playgrounds';2122chai.use(chaiAsPromised);23const expect = chai.expect;2425let donor: IKeyringPair;2627describe('Integration Test: ownerCanTransfer allows admins to use only transferFrom/burnFrom:', () => {28 let alice: IKeyringPair;29 let bob: IKeyringPair;30 let charlie: IKeyringPair;3132 before(async () => {33 await usingPlaygrounds(async (helper, privateKey) => {34 donor = privateKey('//Alice');35 [alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);36 });37 });3839 it('admin transfers other user\'s token', async () => {40 await usingPlaygrounds(async (helper) => {41 const {collectionId} = await helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL'});42 await helper.collection.setLimits(alice, collectionId, {ownerCanTransfer: true});43 const limits = await helper.collection.getEffectiveLimits(collectionId);44 expect(limits.ownerCanTransfer).to.be.true;4546 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});47 const transferResult = async () => helper.nft.transferToken(alice, collectionId, tokenId, {Substrate: charlie.address});48 await expect(transferResult()).to.be.rejected;4950 await helper.nft.transferTokenFrom(alice, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address});51 const newTokenOwner = await helper.nft.getTokenOwner(collectionId, tokenId);52 expect(newTokenOwner.Substrate).to.be.equal(charlie.address);53 });54 });5556 it('admin burns other user\'s token', async () => {57 await usingPlaygrounds(async (helper) => {58 const {collectionId} = await helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL'});5960 await helper.collection.setLimits(alice, collectionId, {ownerCanTransfer: true});61 const limits = await helper.collection.getEffectiveLimits(collectionId);62 expect(limits.ownerCanTransfer).to.be.true;6364 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});65 const burnTxFailed = async () => helper.nft.burnToken(alice, collectionId, tokenId);6667 await expect(burnTxFailed()).to.be.rejected;6869 await helper.nft.burnToken(bob, collectionId, tokenId);70 const token = await helper.nft.getToken(collectionId, tokenId);71 expect(token).to.be.null;72 });73 });74});tests/src/allowLists.test.tsdiffbeforeafterboth--- a/tests/src/allowLists.test.ts
+++ b/tests/src/allowLists.test.ts
@@ -24,12 +24,6 @@
let donor: IKeyringPair;
-before(async () => {
- await usingPlaygrounds(async (_, privateKey) => {
- donor = privateKey('//Alice');
- });
-});
-
let alice: IKeyringPair;
let bob: IKeyringPair;
let charlie: IKeyringPair;
@@ -37,7 +31,8 @@
describe('Integration Test ext. Allow list tests', () => {
before(async () => {
- await usingPlaygrounds(async (helper) => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ donor = privateKey('//Alice');
[alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
});
});