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.tsdiffbeforeafterboth1import {ApiPromise} from '@polkadot/api';2import {IKeyringPair} from '@polkadot/types/types';3import {expect} from 'chai';4import {tokenIdToCross} from '../eth/util/helpers';5import usingApi, {executeTransaction} from '../substrate/substrate-api';6import {getCreateCollectionResult, transferExpectSuccess} from '../util/helpers';78/**9 * ```dot10 * 4 -> 3 -> 2 -> 111 * 7 -> 6 -> 5 -> 212 * 8 -> 513 * ```14 */15async function buildComplexObjectGraph(api: ApiPromise, sender: IKeyringPair): Promise<number> {16 const events = await executeTransaction(api, sender, api.tx.unique.createCollectionEx({mode: 'NFT', permissions: {nesting: 'Owner'}}));17 const {collectionId} = getCreateCollectionResult(events);1819 await executeTransaction(api, sender, api.tx.unique.createMultipleItemsEx(collectionId, {NFT: Array(8).fill({owner: {Substrate: sender.address}})}));2021 await transferExpectSuccess(collectionId, 8, sender, tokenIdToCross(collectionId, 5));2223 await transferExpectSuccess(collectionId, 7, sender, tokenIdToCross(collectionId, 6));24 await transferExpectSuccess(collectionId, 6, sender, tokenIdToCross(collectionId, 5));25 await transferExpectSuccess(collectionId, 5, sender, tokenIdToCross(collectionId, 2));2627 await transferExpectSuccess(collectionId, 4, sender, tokenIdToCross(collectionId, 3));28 await transferExpectSuccess(collectionId, 3, sender, tokenIdToCross(collectionId, 2));29 await transferExpectSuccess(collectionId, 2, sender, tokenIdToCross(collectionId, 1));3031 return collectionId;32}3334describe('Graphs', () => {35 it('Ouroboros can\'t be created in a complex graph', async () => {36 await usingApi(async (api, privateKeyWrapper) => {37 const alice = privateKeyWrapper('//Alice');38 const collection = await buildComplexObjectGraph(api, alice);3940 // to self41 await expect(42 executeTransaction(api, alice, api.tx.unique.transfer(tokenIdToCross(collection, 1), collection, 1, 1)),43 'first transaction', 44 ).to.be.rejectedWith(/structure\.OuroborosDetected/);45 // to nested part of graph46 await expect(47 executeTransaction(api, alice, api.tx.unique.transfer(tokenIdToCross(collection, 5), collection, 1, 1)),48 'second transaction',49 ).to.be.rejectedWith(/structure\.OuroborosDetected/);50 await expect(51 executeTransaction(api, alice, api.tx.unique.transfer(tokenIdToCross(collection, 8), collection, 2, 1)),52 'third transaction',53 ).to.be.rejectedWith(/structure\.OuroborosDetected/);54 });55 });56});1import {ApiPromise} from '@polkadot/api';2import {IKeyringPair} from '@polkadot/types/types';3import {expect} from 'chai';4import {tokenIdToCross} from '../eth/util/helpers';5import usingApi, {executeTransaction} from '../substrate/substrate-api';6import {getCreateCollectionResult, transferExpectSuccess} from '../util/helpers';78/**9 * ```dot10 * 4 -> 3 -> 2 -> 111 * 7 -> 6 -> 5 -> 212 * 8 -> 513 * ```14 */15async function buildComplexObjectGraph(api: ApiPromise, sender: IKeyringPair): Promise<number> {16 const events = await executeTransaction(api, sender, api.tx.unique.createCollectionEx({mode: 'NFT', permissions: {nesting: {tokenOwner: true}}}));17 const {collectionId} = getCreateCollectionResult(events);1819 await executeTransaction(api, sender, api.tx.unique.createMultipleItemsEx(collectionId, {NFT: Array(8).fill({owner: {Substrate: sender.address}})}));2021 await transferExpectSuccess(collectionId, 8, sender, tokenIdToCross(collectionId, 5));2223 await transferExpectSuccess(collectionId, 7, sender, tokenIdToCross(collectionId, 6));24 await transferExpectSuccess(collectionId, 6, sender, tokenIdToCross(collectionId, 5));25 await transferExpectSuccess(collectionId, 5, sender, tokenIdToCross(collectionId, 2));2627 await transferExpectSuccess(collectionId, 4, sender, tokenIdToCross(collectionId, 3));28 await transferExpectSuccess(collectionId, 3, sender, tokenIdToCross(collectionId, 2));29 await transferExpectSuccess(collectionId, 2, sender, tokenIdToCross(collectionId, 1));3031 return collectionId;32}3334describe('Graphs', () => {35 it('Ouroboros can\'t be created in a complex graph', async () => {36 await usingApi(async (api, privateKeyWrapper) => {37 const alice = privateKeyWrapper('//Alice');38 const collection = await buildComplexObjectGraph(api, alice);3940 // to self41 await expect(42 executeTransaction(api, alice, api.tx.unique.transfer(tokenIdToCross(collection, 1), collection, 1, 1)),43 'first transaction', 44 ).to.be.rejectedWith(/structure\.OuroborosDetected/);45 // to nested part of graph46 await expect(47 executeTransaction(api, alice, api.tx.unique.transfer(tokenIdToCross(collection, 5), collection, 1, 1)),48 'second transaction',49 ).to.be.rejectedWith(/structure\.OuroborosDetected/);50 await expect(51 executeTransaction(api, alice, api.tx.unique.transfer(tokenIdToCross(collection, 8), collection, 2, 1)),52 'third transaction',53 ).to.be.rejectedWith(/structure\.OuroborosDetected/);54 });55 });56});tests/src/nesting/rules-smoke.test.tsdiffbeforeafterboth--- a/tests/src/nesting/rules-smoke.test.ts
+++ b/tests/src/nesting/rules-smoke.test.ts
@@ -27,11 +27,11 @@
await usingApi(async api => {
const collection = await createCollectionExpectSuccess({mode: {type: 'Fungible',decimalPoints:0}});
await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {Fungible: {Value: 1}})))
- .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);
+ .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
await createFungibleItemExpectSuccess(alice, collection, {Value:1n}, {Substrate: alice.address});
await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, 0, 1n)))
- .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);
+ .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
});
});
@@ -39,11 +39,11 @@
await usingApi(async api => {
const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {NFT: {properties: []}})))
- .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);
+ .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
const token = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});
await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, token, 1n)))
- .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);
+ .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
});
});
@@ -51,11 +51,11 @@
await usingApi(async api => {
const collection = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {ReFungible: {}})))
- .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);
+ .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
const token = await createItemExpectSuccess(alice, collection, 'ReFungible', {Substrate: alice.address});
await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, token, 1n)))
- .to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);
+ .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
});
});
});