git.delta.rocks / unique-network / refs/commits / 16ab55f38ef5

difftreelog

eslint fixes

rkv2022-09-09parent: #2c4a276.patch.diff
in: master

1 file changed

modifiedtests/src/adminTransferAndBurn.test.tsdiffbeforeafterboth
17import {IKeyringPair} from '@polkadot/types/types';17import {IKeyringPair} from '@polkadot/types/types';
18import chai from 'chai';18import chai from 'chai';
19import chaiAsPromised from 'chai-as-promised';19import chaiAsPromised from 'chai-as-promised';
20import {default as usingApi} from './substrate/substrate-api';
21import {
22 createCollectionExpectSuccess,
23 createItemExpectSuccess,
24 transferExpectFailure,
25 transferFromExpectSuccess,
26 burnItemExpectFailure,
27 burnFromExpectSuccess,
28 setCollectionLimitsExpectSuccess,
29} from './util/helpers';
30import { usingPlaygrounds } from './util/playgrounds';20import {usingPlaygrounds} from './util/playgrounds';
3121
32chai.use(chaiAsPromised);22chai.use(chaiAsPromised);
35let donor: IKeyringPair;25let donor: IKeyringPair;
3626
37before(async () => {27before(async () => {
38 await usingPlaygrounds(async (_, privateKeyWrapper) => {28 await usingPlaygrounds(async (_, privateKey) => {
39 donor = privateKeyWrapper('//Alice');29 donor = privateKey('//Alice');
40 });30 });
41});31});
4232
54 it('admin transfers other user\'s token', async () => {44 it('admin transfers other user\'s token', async () => {
55 await usingPlaygrounds(async (helper) => {45 await usingPlaygrounds(async (helper) => {
56 const {collectionId} = await helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL'});46 const {collectionId} = await helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL'});
57 const setLimitsResult = await helper.collection.setLimits(alice, collectionId, {ownerCanTransfer: true});47 await helper.collection.setLimits(alice, collectionId, {ownerCanTransfer: true});
58 const limits = await helper.collection.getEffectiveLimits(collectionId);48 const limits = await helper.collection.getEffectiveLimits(collectionId);
59 expect(limits.ownerCanTransfer).to.be.true;49 expect(limits.ownerCanTransfer).to.be.true;
6050
61 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});51 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
62 const transferResult = async () => helper.nft.transferToken(alice, collectionId, tokenId, {Substrate: charlie.address});52 const transferResult = async () => helper.nft.transferToken(alice, collectionId, tokenId, {Substrate: charlie.address});
63 await expect(transferResult()).to.be.rejected;53 await expect(transferResult()).to.be.rejected;
6454
65 const res = await helper.nft.transferTokenFrom(alice, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address});55 await helper.nft.transferTokenFrom(alice, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address});
66 const newTokenOwner = await helper.nft.getTokenOwner(collectionId, tokenId);56 const newTokenOwner = await helper.nft.getTokenOwner(collectionId, tokenId);
67 expect(newTokenOwner.Substrate).to.be.equal(charlie.address);57 expect(newTokenOwner.Substrate).to.be.equal(charlie.address);
68 });58 });
72 await usingPlaygrounds(async (helper) => {62 await usingPlaygrounds(async (helper) => {
73 const {collectionId} = await helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL'});63 const {collectionId} = await helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL'});
7464
75 const setLimitsResult = await helper.collection.setLimits(alice, collectionId, {ownerCanTransfer: true});65 await helper.collection.setLimits(alice, collectionId, {ownerCanTransfer: true});
76 const limits = await helper.collection.getEffectiveLimits(collectionId);66 const limits = await helper.collection.getEffectiveLimits(collectionId);
77 expect(limits.ownerCanTransfer).to.be.true;67 expect(limits.ownerCanTransfer).to.be.true;
7868
8171
82 await expect(burnTxFailed()).to.be.rejected;72 await expect(burnTxFailed()).to.be.rejected;
8373
84 const burnResult = await helper.nft.burnToken(bob, collectionId, tokenId);74 await helper.nft.burnToken(bob, collectionId, tokenId);
85 const token = await helper.nft.getToken(collectionId, tokenId);75 const token = await helper.nft.getToken(collectionId, tokenId);
86 expect(token).to.be.null;76 expect(token).to.be.null;
87 });77 });