difftreelog
Update tests to pass on updated substrate (a7fd1e5d59b12)
in: master
6 files changed
tests/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",
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.jsondiffbeforeafterboth1{2 "metadataVersion": "0.1.0",3 "source": {4 "hash": "0x36431d9da78a6bb099474e49c9e35a9c3a04272b58815634082626109826cac6",5 "language": "ink! 3.0.0-rc1",6 "compiler": "rustc 1.49.0-nightly"7 },8 "contract": {9 "name": "flipper",10 "version": "3.0.0-rc1",11 "authors": [12 "Parity Technologies <admin@parity.io>"13 ]14 },15 "spec": {16 "constructors": [17 {18 "args": [19 {20 "name": "init_value",21 "type": {22 "displayName": [23 "bool"24 ],25 "type": 126 }27 }28 ],29 "docs": [30 " Creates a new flipper smart contract initialized with the given value."31 ],32 "name": [33 "new"34 ],35 "selector": "0xd183512b"36 },37 {38 "args": [],39 "docs": [40 " Creates a new flipper smart contract initialized to `false`."41 ],42 "name": [43 "default"44 ],45 "selector": "0x6a3712e2"46 }47 ],48 "docs": [],49 "events": [],50 "messages": [51 {52 "args": [],53 "docs": [54 " Flips the current value of the Flipper's bool."55 ],56 "mutates": true,57 "name": [58 "flip"59 ],60 "payable": false,61 "returnType": null,62 "selector": "0xc096a5f3"63 },64 {65 "args": [],66 "docs": [67 " Returns the current value of the Flipper's bool."68 ],69 "mutates": false,70 "name": [71 "get"72 ],73 "payable": false,74 "returnType": {75 "displayName": [76 "bool"77 ],78 "type": 179 },80 "selector": "0x1e5ca456"81 }82 ]83 },84 "storage": {85 "struct": {86 "fields": [87 {88 "layout": {89 "cell": {90 "key": "0x0000000000000000000000000000000000000000000000000000000000000000",91 "ty": 192 }93 },94 "name": "value"95 }96 ]97 }98 },99 "types": [100 {101 "def": {102 "primitive": "bool"103 }104 }105 ]106}1{2 "metadataVersion": "0.1.0",3 "source": {4 "hash": "0x5b02ceadaacee8408d3c6496394847092c099bcb897221dbe8d22c16d372fa17",5 "language": "ink! 3.0.0-rc2",6 "compiler": "rustc 1.51.0-nightly"7 },8 "contract": {9 "name": "flipper",10 "version": "0.1.0",11 "authors": [12 "[your_name] <[your_email]>"13 ]14 },15 "spec": {16 "constructors": [17 {18 "args": [19 {20 "name": "init_value",21 "type": {22 "displayName": [23 "bool"24 ],25 "type": 126 }27 }28 ],29 "docs": [30 " Constructor that initializes the `bool` value to the given `init_value`."31 ],32 "name": [33 "new"34 ],35 "selector": "0xd183512b"36 },37 {38 "args": [],39 "docs": [40 " Constructor that initializes the `bool` value to `false`.",41 "",42 " Constructors can delegate to other constructors."43 ],44 "name": [45 "default"46 ],47 "selector": "0x6a3712e2"48 }49 ],50 "docs": [],51 "events": [],52 "messages": [53 {54 "args": [],55 "docs": [56 " A message that can be called on instantiated contracts.",57 " This one flips the value of the stored `bool` from `true`",58 " to `false` and vice versa."59 ],60 "mutates": true,61 "name": [62 "flip"63 ],64 "payable": false,65 "returnType": null,66 "selector": "0xc096a5f3"67 },68 {69 "args": [],70 "docs": [71 " Simply returns the current value of our `bool`."72 ],73 "mutates": false,74 "name": [75 "get"76 ],77 "payable": false,78 "returnType": {79 "displayName": [80 "bool"81 ],82 "type": 183 },84 "selector": "0x1e5ca456"85 }86 ]87 },88 "storage": {89 "struct": {90 "fields": [91 {92 "layout": {93 "cell": {94 "key": "0x0000000000000000000000000000000000000000000000000000000000000000",95 "ty": 196 }97 },98 "name": "value"99 }100 ]101 }102 },103 "types": [104 {105 "def": {106 "primitive": "bool"107 }108 }109 ]110}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;
}