git.delta.rocks / unique-network / refs/commits / af54ef4128ee

difftreelog

Update tests to pass on updated substrate (a7fd1e5d59b12)

Greg Zaitsev2021-01-26parent: #13bdc4a.patch.diff
in: master

6 files changed

modifiedtests/package.jsondiffbeforeafterboth
--- a/tests/package.json
+++ b/tests/package.json
@@ -35,7 +35,7 @@
     "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts"
   },
   "author": "",
-  "license": "Apache 2.0",
+  "license": "SEE LICENSE IN ../LICENSE",
   "homepage": "",
   "dependencies": {
     "@polkadot/api": "^3.6.3",
modifiedtests/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', () => {
 
modifiedtests/src/flipper/flipper.wasmdiffbeforeafterboth

binary blob — no preview

modifiedtests/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": [
modifiedtests/src/substrate/substrate-api.tsdiffbeforeafterboth
21 settings = settings || defaultApiOptions();21 settings = settings || defaultApiOptions();
22 let api: ApiPromise = new ApiPromise(settings);22 let api: ApiPromise = new ApiPromise(settings);
23
24 // TODO: Remove, this is temporary: Filter unneeded API output
25 // (Jaco promised it will be removed in the next version)
26 const consoleLog = console.log;
27 console.log = (message: string) => {
28 if (!(message.includes("API/INIT: Capabilities detected") || message.includes("2021-"))) {
29 consoleLog(message);
30 }
31 };
2332
24 try {33 try {
25 await promisifySubstrate(api, async () => {34 await promisifySubstrate(api, async () => {
30 })();39 })();
31 } finally {40 } finally {
32 await api.disconnect();41 await api.disconnect();
42 console.log = consoleLog;
33 }43 }
34}44}
3545
modifiedtests/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;
 }