difftreelog
Update tests to pass on updated substrate (a7fd1e5d59b12)
in: master
6 files changed
tests/package.jsondiffbeforeafterboth1{2 "name": "NftTests",3 "version": "1.0.0",4 "description": "Substrate Nft tests",5 "main": "",6 "devDependencies": {7 "@polkadot/dev": "^0.61.24",8 "@polkadot/ts": "^0.3.59",9 "@polkadot/typegen": "^3.6.3",10 "@polkadot/util-crypto": "^5.4.4",11 "@types/chai": "^4.2.12",12 "@types/chai-as-promised": "^7.1.3",13 "@types/mocha": "^8.0.3",14 "chai": "^4.2.0",15 "mocha": "^8.1.1",16 "ts-node": "^9.0.0",17 "tslint": "^5.20.1",18 "typescript": "^3.9.7"19 },20 "scripts": {21 "test": "mocha --timeout 9999999 -r ts-node/register ./**/*.test.ts",22 "load": "mocha --timeout 9999999 -r ts-node/register ./**/*.load.ts",23 "testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts",24 "testSetSchemaVersion": "mocha --timeout 9999999 -r ts-node/register ./**/setSchemaVersion.test.ts",25 "testSetCollectionLimits": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionLimits.test.ts",26 "testRemoveCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionAdmin.test.ts",27 "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",28 "testCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",29 "testApprove": "mocha --timeout 9999999 -r ts-node/register ./**/approve.test.ts",30 "testTransferFrom": "mocha --timeout 9999999 -r ts-node/register ./**/transferFrom.test.ts",31 "testCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",32 "testToggleContractWhiteList": "mocha --timeout 9999999 -r ts-node/register ./**/toggleContractWhiteList.test.ts",33 "testAddToContractWhiteList": "mocha --timeout 9999999 -r ts-node/register ./**/addToContractWhiteList.test.ts",34 "testTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/transfer.test.ts",35 "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts"36 },37 "author": "",38 "license": "Apache 2.0",39 "homepage": "",40 "dependencies": {41 "@polkadot/api": "^3.6.3",42 "@polkadot/api-contract": "^3.6.3",43 "@polkadot/util": "^3.6.3",44 "bignumber.js": "^9.0.0",45 "chai-as-promised": "^7.1.1"46 },47 "standard": {48 "globals": [49 "it",50 "assert",51 "beforeEach",52 "afterEach",53 "describe",54 "contract",55 "artifacts"56 ]57 }58}1{2 "name": "NftTests",3 "version": "1.0.0",4 "description": "Substrate Nft tests",5 "main": "",6 "devDependencies": {7 "@polkadot/dev": "^0.61.24",8 "@polkadot/ts": "^0.3.59",9 "@polkadot/typegen": "^3.6.3",10 "@polkadot/util-crypto": "^5.4.4",11 "@types/chai": "^4.2.12",12 "@types/chai-as-promised": "^7.1.3",13 "@types/mocha": "^8.0.3",14 "chai": "^4.2.0",15 "mocha": "^8.1.1",16 "ts-node": "^9.0.0",17 "tslint": "^5.20.1",18 "typescript": "^3.9.7"19 },20 "scripts": {21 "test": "mocha --timeout 9999999 -r ts-node/register ./**/*.test.ts",22 "load": "mocha --timeout 9999999 -r ts-node/register ./**/*.load.ts",23 "testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts",24 "testSetSchemaVersion": "mocha --timeout 9999999 -r ts-node/register ./**/setSchemaVersion.test.ts",25 "testSetCollectionLimits": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionLimits.test.ts",26 "testRemoveCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionAdmin.test.ts",27 "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",28 "testCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",29 "testApprove": "mocha --timeout 9999999 -r ts-node/register ./**/approve.test.ts",30 "testTransferFrom": "mocha --timeout 9999999 -r ts-node/register ./**/transferFrom.test.ts",31 "testCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",32 "testToggleContractWhiteList": "mocha --timeout 9999999 -r ts-node/register ./**/toggleContractWhiteList.test.ts",33 "testAddToContractWhiteList": "mocha --timeout 9999999 -r ts-node/register ./**/addToContractWhiteList.test.ts",34 "testTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/transfer.test.ts",35 "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts"36 },37 "author": "",38 "license": "SEE LICENSE IN ../LICENSE",39 "homepage": "",40 "dependencies": {41 "@polkadot/api": "^3.6.3",42 "@polkadot/api-contract": "^3.6.3",43 "@polkadot/util": "^3.6.3",44 "bignumber.js": "^9.0.0",45 "chai-as-promised": "^7.1.1"46 },47 "standard": {48 "globals": [49 "it",50 "assert",51 "beforeEach",52 "afterEach",53 "describe",54 "contract",55 "artifacts"56 ]57 }58}tests/src/addToContractWhiteList.test.tsdiffbeforeafterboth--- a/tests/src/addToContractWhiteList.test.ts
+++ b/tests/src/addToContractWhiteList.test.ts
@@ -3,8 +3,7 @@
import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from "./substrate/substrate-api";
import privateKey from "./substrate/privateKey";
import {
- deployFlipper,
- getFlipValue
+ deployFlipper
} from "./util/contracthelpers";
import {
getGenericResult
@@ -12,9 +11,6 @@
chai.use(chaiAsPromised);
const expect = chai.expect;
-
-const value = 0;
-const gasLimit = 3000n * 1000000n;
describe('Integration Test addToContractWhiteList', () => {
tests/src/flipper/flipper.wasmdiffbeforeafterbothbinary blob — no preview
tests/src/flipper/metadata.jsondiffbeforeafterboth--- a/tests/src/flipper/metadata.json
+++ b/tests/src/flipper/metadata.json
@@ -1,15 +1,15 @@
{
"metadataVersion": "0.1.0",
"source": {
- "hash": "0x36431d9da78a6bb099474e49c9e35a9c3a04272b58815634082626109826cac6",
- "language": "ink! 3.0.0-rc1",
- "compiler": "rustc 1.49.0-nightly"
+ "hash": "0x5b02ceadaacee8408d3c6496394847092c099bcb897221dbe8d22c16d372fa17",
+ "language": "ink! 3.0.0-rc2",
+ "compiler": "rustc 1.51.0-nightly"
},
"contract": {
"name": "flipper",
- "version": "3.0.0-rc1",
+ "version": "0.1.0",
"authors": [
- "Parity Technologies <admin@parity.io>"
+ "[your_name] <[your_email]>"
]
},
"spec": {
@@ -27,7 +27,7 @@
}
],
"docs": [
- " Creates a new flipper smart contract initialized with the given value."
+ " Constructor that initializes the `bool` value to the given `init_value`."
],
"name": [
"new"
@@ -37,7 +37,9 @@
{
"args": [],
"docs": [
- " Creates a new flipper smart contract initialized to `false`."
+ " Constructor that initializes the `bool` value to `false`.",
+ "",
+ " Constructors can delegate to other constructors."
],
"name": [
"default"
@@ -51,7 +53,9 @@
{
"args": [],
"docs": [
- " Flips the current value of the Flipper's bool."
+ " A message that can be called on instantiated contracts.",
+ " This one flips the value of the stored `bool` from `true`",
+ " to `false` and vice versa."
],
"mutates": true,
"name": [
@@ -64,7 +68,7 @@
{
"args": [],
"docs": [
- " Returns the current value of the Flipper's bool."
+ " Simply returns the current value of our `bool`."
],
"mutates": false,
"name": [
tests/src/substrate/substrate-api.tsdiffbeforeafterboth--- a/tests/src/substrate/substrate-api.ts
+++ b/tests/src/substrate/substrate-api.ts
@@ -21,6 +21,15 @@
settings = settings || defaultApiOptions();
let api: ApiPromise = new ApiPromise(settings);
+ // TODO: Remove, this is temporary: Filter unneeded API output
+ // (Jaco promised it will be removed in the next version)
+ const consoleLog = console.log;
+ console.log = (message: string) => {
+ if (!(message.includes("API/INIT: Capabilities detected") || message.includes("2021-"))) {
+ consoleLog(message);
+ }
+ };
+
try {
await promisifySubstrate(api, async () => {
if(api) {
@@ -30,6 +39,7 @@
})();
} finally {
await api.disconnect();
+ console.log = consoleLog;
}
}
tests/src/util/contracthelpers.tsdiffbeforeafterboth--- a/tests/src/util/contracthelpers.ts
+++ b/tests/src/util/contracthelpers.ts
@@ -86,11 +86,9 @@
export async function getFlipValue(contract: Contract, deployer: IKeyringPair) {
const result = await contract.query.get(deployer.address, value, gasLimit);
- console.log(result);
-// if(!result.result.isSuccess) {
-// throw `Failed to get flipper value`;
-// }
-// return (result.result.asSuccess.data[0] == 0x00) ? false : true;
- return false;
+ if(!result.result.isOk) {
+ throw `Failed to get flipper value`;
+ }
+ return (result.result.asOk.data[0] == 0x00) ? false : true;
}