difftreelog
Fix tests
in: master
3 files changed
tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -51,7 +51,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const newAdmin = privateKey('//Alice');
+ const newAdmin = privateKeyWrapper('//Alice');
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdminSubstrate(newAdmin.addressRaw).send();
@@ -180,7 +180,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const newAdmin = privateKey('//Alice');
+ const newAdmin = privateKeyWrapper('//Alice');
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdminSubstrate(newAdmin.addressRaw).send();
{
@@ -255,7 +255,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const adminSub = privateKey('//Alice');
+ const adminSub = privateKeyWrapper('//Alice');
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();
const adminEth = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
@@ -280,7 +280,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const adminSub = privateKey('//Alice');
+ const adminSub = privateKeyWrapper('//Alice');
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();
const notAdminEth = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
tests/src/nesting/graphs.test.tsdiffbeforeafterboth--- a/tests/src/nesting/graphs.test.ts
+++ b/tests/src/nesting/graphs.test.ts
@@ -13,7 +13,7 @@
* ```
*/
async function buildComplexObjectGraph(api: ApiPromise, sender: IKeyringPair): Promise<number> {
- const events = await executeTransaction(api, sender, api.tx.unique.createCollectionEx({mode: 'NFT', permissions: {nesting: 'Owner'}}));
+ const events = await executeTransaction(api, sender, api.tx.unique.createCollectionEx({mode: 'NFT', permissions: {nesting: {tokenOwner: true}}}));
const {collectionId} = getCreateCollectionResult(events);
await executeTransaction(api, sender, api.tx.unique.createMultipleItemsEx(collectionId, {NFT: Array(8).fill({owner: {Substrate: sender.address}})}));
tests/src/nesting/rules-smoke.test.tsdiffbeforeafterboth1import {expect} from 'chai';2import {tokenIdToAddress} from '../eth/util/helpers';3import usingApi, {executeTransaction} from '../substrate/substrate-api';4import {createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, CrossAccountId, getCreateCollectionResult} from '../util/helpers';5import {IKeyringPair} from '@polkadot/types/types';67describe('nesting check', () => {8 let alice!: IKeyringPair;9 let nestTarget!: CrossAccountId;10 before(async() => {11 await usingApi(async (api, privateKeyWrapper) => {12 alice = privateKeyWrapper('//Alice');13 const bob = privateKeyWrapper('//Bob');14 const events = await executeTransaction(api, alice, api.tx.unique.createCollectionEx({15 mode: 'NFT',16 permissions: {17 nesting: {tokenOwner: true, restricted: []},18 },19 }));20 const collection = getCreateCollectionResult(events).collectionId;21 const token = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: bob.address});22 nestTarget = {Ethereum: tokenIdToAddress(collection, token)};23 });24 });2526 it('called for fungible', async () => {27 await usingApi(async api => {28 const collection = await createCollectionExpectSuccess({mode: {type: 'Fungible',decimalPoints:0}});29 await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {Fungible: {Value: 1}})))30 .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);3132 await createFungibleItemExpectSuccess(alice, collection, {Value:1n}, {Substrate: alice.address});33 await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, 0, 1n)))34 .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);35 });36 });3738 it('called for nonfungible', async () => {39 await usingApi(async api => {40 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});41 await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {NFT: {properties: []}})))42 .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);4344 const token = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});45 await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, token, 1n)))46 .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);47 });48 });4950 it('called for refungible', async () => {51 await usingApi(async api => {52 const collection = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});53 await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {ReFungible: {}})))54 .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);5556 const token = await createItemExpectSuccess(alice, collection, 'ReFungible', {Substrate: alice.address});57 await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, token, 1n)))58 .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);59 });60 });61});1import {expect} from 'chai';2import {tokenIdToAddress} from '../eth/util/helpers';3import usingApi, {executeTransaction} from '../substrate/substrate-api';4import {createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, CrossAccountId, getCreateCollectionResult} from '../util/helpers';5import {IKeyringPair} from '@polkadot/types/types';67describe('nesting check', () => {8 let alice!: IKeyringPair;9 let nestTarget!: CrossAccountId;10 before(async() => {11 await usingApi(async (api, privateKeyWrapper) => {12 alice = privateKeyWrapper('//Alice');13 const bob = privateKeyWrapper('//Bob');14 const events = await executeTransaction(api, alice, api.tx.unique.createCollectionEx({15 mode: 'NFT',16 permissions: {17 nesting: {tokenOwner: true, restricted: []},18 },19 }));20 const collection = getCreateCollectionResult(events).collectionId;21 const token = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: bob.address});22 nestTarget = {Ethereum: tokenIdToAddress(collection, token)};23 });24 });2526 it('called for fungible', async () => {27 await usingApi(async api => {28 const collection = await createCollectionExpectSuccess({mode: {type: 'Fungible',decimalPoints:0}});29 await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {Fungible: {Value: 1}})))30 .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);3132 await createFungibleItemExpectSuccess(alice, collection, {Value:1n}, {Substrate: alice.address});33 await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, 0, 1n)))34 .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);35 });36 });3738 it('called for nonfungible', async () => {39 await usingApi(async api => {40 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});41 await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {NFT: {properties: []}})))42 .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);4344 const token = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});45 await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, token, 1n)))46 .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);47 });48 });4950 it('called for refungible', async () => {51 await usingApi(async api => {52 const collection = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});53 await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {ReFungible: {}})))54 .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);5556 const token = await createItemExpectSuccess(alice, collection, 'ReFungible', {Substrate: alice.address});57 await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, token, 1n)))58 .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);59 });60 });61});