diff --git a/src/CWSimulateApp.spec.ts b/src/CWSimulateApp.spec.ts index 521cd36..2b7d3d1 100644 --- a/src/CWSimulateApp.spec.ts +++ b/src/CWSimulateApp.spec.ts @@ -1,6 +1,8 @@ import { toBase64 } from '@cosmjs/encoding'; import fs from 'fs'; import { CWSimulateApp } from './CWSimulateApp'; +import * as persist from './persist'; +import { TestContract } from '../testing/wasm-util'; const bytecode = fs.readFileSync('./testing/cw_simulate_tests-aarch64.wasm'); @@ -11,7 +13,11 @@ describe('de/serialize', () => { ref.wasm.create('alice', bytecode); ref.wasm.create('bob', bytecode); - const clone = CWSimulateApp.deserialize(ref.serialize()); + const response = await ref.wasm.instantiateContract('alice', [], 1, {}, ''); + const address = response.unwrap().events[0].attributes[0].value; + + const bytes = persist.save(ref); + const clone = await persist.load(bytes); expect(clone.chainId).toStrictEqual(ref.chainId); expect(clone.bech32Prefix).toStrictEqual(ref.bech32Prefix); @@ -21,6 +27,9 @@ describe('de/serialize', () => { expect(code2.creator).toStrictEqual('bob'); expect(toBase64(code1.wasmCode)).toStrictEqual(toBase64(ref.wasm.store.getObject('codes', 1, 'wasmCode'))); expect(toBase64(code2.wasmCode)).toStrictEqual(toBase64(ref.wasm.store.getObject('codes', 2, 'wasmCode'))); + + let result = await clone.wasm.executeContract('alice', [], address, { debug: { msg: 'foobar' }}); + expect(result.ok).toBeTruthy(); } }) })