difftreelog
Update tests to pass on updated substrate (a7fd1e5d59b12)
in: master
6 files changed
tests/package.jsondiffbeforeafterboth35 "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts"35 "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts"36 },36 },37 "author": "",37 "author": "",38 "license": "Apache 2.0",38 "license": "SEE LICENSE IN ../LICENSE",39 "homepage": "",39 "homepage": "",40 "dependencies": {40 "dependencies": {41 "@polkadot/api": "^3.6.3",41 "@polkadot/api": "^3.6.3",tests/src/addToContractWhiteList.test.tsdiffbeforeafterboth3import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from "./substrate/substrate-api";3import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from "./substrate/substrate-api";4import privateKey from "./substrate/privateKey";4import privateKey from "./substrate/privateKey";5import {5import {6 deployFlipper,6 deployFlipper7 getFlipValue8} from "./util/contracthelpers";7} from "./util/contracthelpers";9import {8import {10 getGenericResult9 getGenericResult13chai.use(chaiAsPromised);12chai.use(chaiAsPromised);14const expect = chai.expect;13const expect = chai.expect;1516const value = 0;17const gasLimit = 3000n * 1000000n;181419describe('Integration Test addToContractWhiteList', () => {15describe('Integration Test addToContractWhiteList', () => {2016tests/src/flipper/flipper.wasmdiffbeforeafterbothbinary blob — no preview
tests/src/flipper/metadata.jsondiffbeforeafterboth1{1{2 "metadataVersion": "0.1.0",2 "metadataVersion": "0.1.0",3 "source": {3 "source": {4 "hash": "0x36431d9da78a6bb099474e49c9e35a9c3a04272b58815634082626109826cac6",4 "hash": "0x5b02ceadaacee8408d3c6496394847092c099bcb897221dbe8d22c16d372fa17",5 "language": "ink! 3.0.0-rc1",5 "language": "ink! 3.0.0-rc2",6 "compiler": "rustc 1.49.0-nightly"6 "compiler": "rustc 1.51.0-nightly"7 },7 },8 "contract": {8 "contract": {9 "name": "flipper",9 "name": "flipper",10 "version": "3.0.0-rc1",10 "version": "0.1.0",11 "authors": [11 "authors": [12 "Parity Technologies <admin@parity.io>"12 "[your_name] <[your_email]>"13 ]13 ]14 },14 },15 "spec": {15 "spec": {27 }27 }28 ],28 ],29 "docs": [29 "docs": [30 " Creates a new flipper smart contract initialized with the given value."30 " Constructor that initializes the `bool` value to the given `init_value`."31 ],31 ],32 "name": [32 "name": [33 "new"33 "new"37 {37 {38 "args": [],38 "args": [],39 "docs": [39 "docs": [40 " Creates a new flipper smart contract initialized to `false`."40 " Constructor that initializes the `bool` value to `false`.",41 "",42 " Constructors can delegate to other constructors."41 ],43 ],42 "name": [44 "name": [43 "default"45 "default"51 {53 {52 "args": [],54 "args": [],53 "docs": [55 "docs": [54 " Flips the current value of the Flipper's bool."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."55 ],59 ],56 "mutates": true,60 "mutates": true,57 "name": [61 "name": [64 {68 {65 "args": [],69 "args": [],66 "docs": [70 "docs": [67 " Returns the current value of the Flipper's bool."71 " Simply returns the current value of our `bool`."68 ],72 ],69 "mutates": false,73 "mutates": false,70 "name": [74 "name": [tests/src/substrate/substrate-api.tsdiffbeforeafterboth21 settings = settings || defaultApiOptions();21 settings = settings || defaultApiOptions();22 let api: ApiPromise = new ApiPromise(settings);22 let api: ApiPromise = new ApiPromise(settings);2324 // 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 };233224 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}3545tests/src/util/contracthelpers.tsdiffbeforeafterboth87export async function getFlipValue(contract: Contract, deployer: IKeyringPair) {87export async function getFlipValue(contract: Contract, deployer: IKeyringPair) {88 const result = await contract.query.get(deployer.address, value, gasLimit);88 const result = await contract.query.get(deployer.address, value, gasLimit);8989 console.log(result);90 if(!result.result.isOk) {9091 throw `Failed to get flipper value`;91// if(!result.result.isSuccess) {92 }92// throw `Failed to get flipper value`;93// }94// return (result.result.asSuccess.data[0] == 0x00) ? false : true;95 return false;93 return (result.result.asOk.data[0] == 0x00) ? false : true;96}94}9795