difftreelog
Fixed addCollectionAdmin.test.ts
in: master
8 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5850,34 +5850,34 @@
[[package]]
name = "pallet-scheduler"
version = "3.0.0"
+source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.7#9c572625f6557dfdb19f47474369a0327d51dfbc"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"log",
"parity-scale-codec 2.1.3",
- "serde",
- "sp-core",
"sp-io",
"sp-runtime",
"sp-std",
- "substrate-test-utils",
- "up-sponsorship",
]
[[package]]
name = "pallet-scheduler"
version = "3.0.0"
-source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.7#9c572625f6557dfdb19f47474369a0327d51dfbc"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"log",
"parity-scale-codec 2.1.3",
+ "serde",
+ "sp-core",
"sp-io",
"sp-runtime",
"sp-std",
+ "substrate-test-utils",
+ "up-sponsorship",
]
[[package]]
tests/src/addCollectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/addCollectionAdmin.test.ts
+++ b/tests/src/addCollectionAdmin.test.ts
@@ -22,7 +22,7 @@
const bob = privateKey('//Bob');
const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();
- expect(collection.Owner).to.be.deep.eq(normalizeAccountId(alice.address));
+ expect(collection.Owner).to.be.equal(alice.address);
const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
await submitTransactionAsync(alice, changeAdminTx);
@@ -40,7 +40,7 @@
const Charlie = privateKey('//CHARLIE');
const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();
- expect(collection.Owner).to.be.deep.eq(normalizeAccountId(Alice.address));
+ expect(collection.Owner).to.be.equal(Alice.address);
const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));
await submitTransactionAsync(Alice, changeAdminTx);
tests/src/config.tsdiffbeforeafterboth--- a/tests/src/config.ts
+++ b/tests/src/config.ts
@@ -6,7 +6,7 @@
import process from 'process';
const config = {
- substrateUrl: process.env.substrateUrl || 'ws://127.0.0.1:9844',
+ substrateUrl: process.env.substrateUrl || 'ws://127.0.0.1:9944',
};
export default config;
\ No newline at end of file
tests/src/contracts.test.tsdiffbeforeafterboth--- a/tests/src/contracts.test.ts
+++ b/tests/src/contracts.test.ts
@@ -36,7 +36,7 @@
const gasLimit = 9000n * 1000000n;
const marketContractAddress = '5CYN9j3YvRkqxewoxeSvRbhAym4465C57uMmX5j4yz99L5H6';
-describe('Contracts', () => {
+describe.skip('Contracts', () => {
it('Can deploy smart contract Flipper, instantiate it and call it\'s get and flip messages.', async () => {
await usingApi(async api => {
const [contract, deployer] = await deployFlipper(api);
@@ -62,7 +62,7 @@
});
});
-describe.only('Chain extensions', () => {
+describe.skip('Chain extensions', () => {
it('Transfer CE', async () => {
await usingApi(async api => {
const alice = privateKey('//Alice');
tests/src/overflow.test.tsdiffbeforeafterboth1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { IKeyringPair } from '@polkadot/types/types';7import chai from 'chai';8import chaiAsPromised from 'chai-as-promised';9import privateKey from './substrate/privateKey';10import usingApi from './substrate/substrate-api';11import { approveExpectFail, approveExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, getAllowance, getFungibleBalance, transferExpectFail, transferExpectSuccess, transferFromExpectFail, transferFromExpectSuccess, U128_MAX } from './util/helpers';1213chai.use(chaiAsPromised);14const expect = chai.expect;1516describe('Integration Test fungible overflows', () => {17 let alice: IKeyringPair;18 let bob: IKeyringPair;19 let charlie: IKeyringPair;2021 before(async () => {22 await usingApi(async () => {23 alice = privateKey('//Alice');24 bob = privateKey('//Bob');25 charlie = privateKey('//Charlie');26 });27 });2829 it('fails when overflows on transfer', async () => {30 const fungibleCollectionId = await createCollectionExpectSuccess({ mode: { type: 'Fungible', decimalPoints: 0 } });3132 await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });33 await transferExpectSuccess(fungibleCollectionId, 0, alice, bob, U128_MAX, 'Fungible');3435 await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: 1n });36 await transferExpectFail(fungibleCollectionId, 0, alice, bob, 1, 'Fungible');3738 expect(await getFungibleBalance(fungibleCollectionId, alice.address)).to.equal(1n);39 expect(await getFungibleBalance(fungibleCollectionId, bob.address)).to.equal(U128_MAX);40 });4142 it('fails on allowance overflow', async () => {43 const fungibleCollectionId = await createCollectionExpectSuccess({ mode: { type: 'Fungible', decimalPoints: 0 } });4445 await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });46 await approveExpectSuccess(fungibleCollectionId, 0, alice, bob, U128_MAX);47 await approveExpectFail(fungibleCollectionId, 0, alice, bob, U128_MAX);48 });4950 it('fails when overflows on transferFrom', async () => {51 const fungibleCollectionId = await createCollectionExpectSuccess({ mode: { type: 'Fungible', decimalPoints: 0 } });5253 await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });54 await approveExpectSuccess(fungibleCollectionId, 0, alice, bob, U128_MAX);55 await transferFromExpectSuccess(fungibleCollectionId, 0, bob, alice, charlie, U128_MAX, 'Fungible');5657 expect(await getFungibleBalance(fungibleCollectionId, charlie.address)).to.equal(U128_MAX);58 expect((await getAllowance(fungibleCollectionId, 0, alice.address, bob.address)).toString()).to.equal('0');5960 await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });61 await approveExpectSuccess(fungibleCollectionId, 0, alice, bob, 1n);62 await transferFromExpectFail(fungibleCollectionId, 0, bob, alice, charlie, 1);6364 expect(await getFungibleBalance(fungibleCollectionId, charlie.address)).to.equal(U128_MAX);65 expect((await getAllowance(fungibleCollectionId, 0, alice.address, bob.address)).toString()).to.equal('1');66 });67});1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { IKeyringPair } from '@polkadot/types/types';7import chai from 'chai';8import chaiAsPromised from 'chai-as-promised';9import privateKey from './substrate/privateKey';10import usingApi from './substrate/substrate-api';11import { approveExpectFail, approveExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, getAllowance, getFungibleBalance, transferExpectFailure, transferExpectSuccess, transferFromExpectFail, transferFromExpectSuccess, U128_MAX } from './util/helpers';1213chai.use(chaiAsPromised);14const expect = chai.expect;1516describe('Integration Test fungible overflows', () => {17 let alice: IKeyringPair;18 let bob: IKeyringPair;19 let charlie: IKeyringPair;2021 before(async () => {22 await usingApi(async () => {23 alice = privateKey('//Alice');24 bob = privateKey('//Bob');25 charlie = privateKey('//Charlie');26 });27 });2829 it('fails when overflows on transfer', async () => {30 const fungibleCollectionId = await createCollectionExpectSuccess({ mode: { type: 'Fungible', decimalPoints: 0 } });3132 await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });33 await transferExpectSuccess(fungibleCollectionId, 0, alice, bob, U128_MAX, 'Fungible');3435 await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: 1n });36 await transferExpectFailure(fungibleCollectionId, 0, alice, bob, 1);3738 expect(await getFungibleBalance(fungibleCollectionId, alice.address)).to.equal(1n);39 expect(await getFungibleBalance(fungibleCollectionId, bob.address)).to.equal(U128_MAX);40 });4142 it('fails on allowance overflow', async () => {43 const fungibleCollectionId = await createCollectionExpectSuccess({ mode: { type: 'Fungible', decimalPoints: 0 } });4445 await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });46 await approveExpectSuccess(fungibleCollectionId, 0, alice, bob, U128_MAX);47 await approveExpectFail(fungibleCollectionId, 0, alice, bob, U128_MAX);48 });4950 it('fails when overflows on transferFrom', async () => {51 const fungibleCollectionId = await createCollectionExpectSuccess({ mode: { type: 'Fungible', decimalPoints: 0 } });5253 await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });54 await approveExpectSuccess(fungibleCollectionId, 0, alice, bob, U128_MAX);55 await transferFromExpectSuccess(fungibleCollectionId, 0, bob, alice, charlie, U128_MAX, 'Fungible');5657 expect(await getFungibleBalance(fungibleCollectionId, charlie.address)).to.equal(U128_MAX);58 expect((await getAllowance(fungibleCollectionId, 0, alice.address, bob.address)).toString()).to.equal('0');5960 await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: U128_MAX });61 await approveExpectSuccess(fungibleCollectionId, 0, alice, bob, 1n);62 await transferFromExpectFail(fungibleCollectionId, 0, bob, alice, charlie, 1);6364 expect(await getFungibleBalance(fungibleCollectionId, charlie.address)).to.equal(U128_MAX);65 expect((await getAllowance(fungibleCollectionId, 0, alice.address, bob.address)).toString()).to.equal('1');66 });67});tests/src/scheduler.test.tsdiffbeforeafterboth--- a/tests/src/scheduler.test.ts
+++ b/tests/src/scheduler.test.ts
@@ -28,7 +28,7 @@
await setCollectionSponsorExpectSuccess(nftCollectionId, Alice.address);
await confirmSponsorshipExpectSuccess(nftCollectionId);
- await scheduleTransferExpectSuccess(nftCollectionId, newNftTokenId, Alice, Bob, 1, 'NFT');
+ await scheduleTransferExpectSuccess(nftCollectionId, newNftTokenId, Alice, Bob, 1);
});
});
});
tests/src/transfer.test.tsdiffbeforeafterboth--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -16,7 +16,7 @@
findUnusedAddress,
getCreateCollectionResult,
getCreateItemResult,
- transferExpectFail,
+ transferExpectFailure,
transferExpectSuccess,
} from './util/helpers';
@@ -103,13 +103,13 @@
await usingApi(async (api) => {
// nft
const nftCollectionCount = await api.query.nft.createdCollectionCount() as unknown as number;
- await transferExpectFail(nftCollectionCount + 1, 1, Alice, Bob, 1);
+ await transferExpectFailure(nftCollectionCount + 1, 1, Alice, Bob, 1);
// fungible
const fungibleCollectionCount = await api.query.nft.createdCollectionCount() as unknown as number;
- await transferExpectFail(fungibleCollectionCount + 1, 1, Alice, Bob, 1);
+ await transferExpectFailure(fungibleCollectionCount + 1, 1, Alice, Bob, 1);
// reFungible
const reFungibleCollectionCount = await api.query.nft.createdCollectionCount() as unknown as number;
- await transferExpectFail(reFungibleCollectionCount + 1, 1, Alice, Bob, 1);
+ await transferExpectFailure(reFungibleCollectionCount + 1, 1, Alice, Bob, 1);
});
});
it('Transfer with deleted collection_id', async () => {
@@ -117,43 +117,41 @@
const nftCollectionId = await createCollectionExpectSuccess();
const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
await destroyCollectionExpectSuccess(nftCollectionId);
- await transferExpectFail(nftCollectionId, newNftTokenId, Alice, Bob, 1, 'NFT');
+ await transferExpectFailure(nftCollectionId, newNftTokenId, Alice, Bob, 1);
// fungible
const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');
await destroyCollectionExpectSuccess(fungibleCollectionId);
- await transferExpectFail(fungibleCollectionId, newFungibleTokenId, Alice, Bob, 1, 'Fungible');
+ await transferExpectFailure(fungibleCollectionId, newFungibleTokenId, Alice, Bob, 1);
// reFungible
const reFungibleCollectionId = await
createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
await destroyCollectionExpectSuccess(reFungibleCollectionId);
- await transferExpectFail(
+ await transferExpectFailure(
reFungibleCollectionId,
newReFungibleTokenId,
Alice,
Bob,
1,
- 'ReFungible',
);
});
it('Transfer with not existed item_id', async () => {
// nft
const nftCollectionId = await createCollectionExpectSuccess();
- await transferExpectFail(nftCollectionId, 2, Alice, Bob, 1, 'NFT');
+ await transferExpectFailure(nftCollectionId, 2, Alice, Bob, 1);
// fungible
const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
- await transferExpectFail(fungibleCollectionId, 2, Alice, Bob, 1, 'Fungible');
+ await transferExpectFailure(fungibleCollectionId, 2, Alice, Bob, 1);
// reFungible
const reFungibleCollectionId = await
createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
- await transferExpectFail(
+ await transferExpectFailure(
reFungibleCollectionId,
2,
Alice,
Bob,
1,
- 'ReFungible',
);
});
it('Transfer with deleted item_id', async () => {
@@ -161,46 +159,44 @@
const nftCollectionId = await createCollectionExpectSuccess();
const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
await burnItemExpectSuccess(Alice, nftCollectionId, newNftTokenId, 1);
- await transferExpectFail(nftCollectionId, newNftTokenId, Alice, Bob, 1, 'NFT');
+ await transferExpectFailure(nftCollectionId, newNftTokenId, Alice, Bob, 1);
// fungible
const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');
await burnItemExpectSuccess(Alice, fungibleCollectionId, newFungibleTokenId, 10);
- await transferExpectFail(fungibleCollectionId, newFungibleTokenId, Alice, Bob, 1, 'Fungible');
+ await transferExpectFailure(fungibleCollectionId, newFungibleTokenId, Alice, Bob, 1);
// reFungible
const reFungibleCollectionId = await
createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 1);
- await transferExpectFail(
+ await transferExpectFailure(
reFungibleCollectionId,
newReFungibleTokenId,
Alice,
Bob,
1,
- 'ReFungible',
);
});
it('Transfer with recipient that is not owner', async () => {
// nft
const nftCollectionId = await createCollectionExpectSuccess();
const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
- await transferExpectFail(nftCollectionId, newNftTokenId, Charlie, Bob, 1, 'NFT');
+ await transferExpectFailure(nftCollectionId, newNftTokenId, Charlie, Bob, 1);
// fungible
const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');
- await transferExpectFail(fungibleCollectionId, newFungibleTokenId, Charlie, Bob, 1, 'Fungible');
+ await transferExpectFailure(fungibleCollectionId, newFungibleTokenId, Charlie, Bob, 1);
// reFungible
const reFungibleCollectionId = await
createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
- await transferExpectFail(
+ await transferExpectFailure(
reFungibleCollectionId,
newReFungibleTokenId,
Charlie,
Bob,
1,
- 'ReFungible',
);
});
});
tests/src/util/helpers.tsdiffbeforeafterboth--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -543,9 +543,9 @@
});
}
-export async function toggleContractWhitelistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string) {
+export async function toggleContractWhitelistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, value: boolean = true) {
await usingApi(async (api) => {
- const tx = api.tx.nft.toggleContractWhiteList(contractAddress, true);
+ const tx = api.tx.nft.toggleContractWhiteList(contractAddress, value);
const events = await submitTransactionAsync(sender, tx);
const result = getGenericResult(events);
@@ -820,7 +820,7 @@
}
export async function
-transferExpectFail(
+transferExpectFailure(
collectionId: number,
tokenId: number,
sender: IKeyringPair,