difftreelog
Fixed addCollectionAdmin.test.ts
in: master
8 files changed
Cargo.lockdiffbeforeafterboth5847 "sp-std",5847 "sp-std",5848]5848]58495850[[package]]5851name = "pallet-scheduler"5852version = "3.0.0"5853dependencies = [5854 "frame-benchmarking",5855 "frame-support",5856 "frame-system",5857 "log",5858 "parity-scale-codec 2.1.3",5859 "serde",5860 "sp-core",5861 "sp-io",5862 "sp-runtime",5863 "sp-std",5864 "substrate-test-utils",5865 "up-sponsorship",5866]586758495868[[package]]5850[[package]]5869name = "pallet-scheduler"5851name = "pallet-scheduler"5880 "sp-std",5862 "sp-std",5881]5863]58645865[[package]]5866name = "pallet-scheduler"5867version = "3.0.0"5868dependencies = [5869 "frame-benchmarking",5870 "frame-support",5871 "frame-system",5872 "log",5873 "parity-scale-codec 2.1.3",5874 "serde",5875 "sp-core",5876 "sp-io",5877 "sp-runtime",5878 "sp-std",5879 "substrate-test-utils",5880 "up-sponsorship",5881]588258825883[[package]]5883[[package]]5884name = "pallet-session"5884name = "pallet-session"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.tsdiffbeforeafterboth--- a/tests/src/overflow.test.ts
+++ b/tests/src/overflow.test.ts
@@ -8,7 +8,7 @@
import chaiAsPromised from 'chai-as-promised';
import privateKey from './substrate/privateKey';
import usingApi from './substrate/substrate-api';
-import { approveExpectFail, approveExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, getAllowance, getFungibleBalance, transferExpectFail, transferExpectSuccess, transferFromExpectFail, transferFromExpectSuccess, U128_MAX } from './util/helpers';
+import { approveExpectFail, approveExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, getAllowance, getFungibleBalance, transferExpectFailure, transferExpectSuccess, transferFromExpectFail, transferFromExpectSuccess, U128_MAX } from './util/helpers';
chai.use(chaiAsPromised);
const expect = chai.expect;
@@ -33,7 +33,7 @@
await transferExpectSuccess(fungibleCollectionId, 0, alice, bob, U128_MAX, 'Fungible');
await createFungibleItemExpectSuccess(alice, fungibleCollectionId, { Value: 1n });
- await transferExpectFail(fungibleCollectionId, 0, alice, bob, 1, 'Fungible');
+ await transferExpectFailure(fungibleCollectionId, 0, alice, bob, 1);
expect(await getFungibleBalance(fungibleCollectionId, alice.address)).to.equal(1n);
expect(await getFungibleBalance(fungibleCollectionId, bob.address)).to.equal(U128_MAX);
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,