Skip to content

Commit fa7aa92

Browse files
committed
fix & improve serde integration test
could use some more coverage tho...
1 parent 2ef53cb commit fa7aa92

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/CWSimulateApp.spec.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { toBase64 } from '@cosmjs/encoding';
22
import fs from 'fs';
33
import { CWSimulateApp } from './CWSimulateApp';
4+
import * as persist from './persist';
5+
import { TestContract } from '../testing/wasm-util';
46

57
const bytecode = fs.readFileSync('./testing/cw_simulate_tests-aarch64.wasm');
68

@@ -11,7 +13,11 @@ describe('de/serialize', () => {
1113
ref.wasm.create('alice', bytecode);
1214
ref.wasm.create('bob', bytecode);
1315

14-
const clone = CWSimulateApp.deserialize(ref.serialize());
16+
const response = await ref.wasm.instantiateContract('alice', [], 1, {}, '');
17+
const address = response.unwrap().events[0].attributes[0].value;
18+
19+
const bytes = persist.save(ref);
20+
const clone = await persist.load(bytes);
1521
expect(clone.chainId).toStrictEqual(ref.chainId);
1622
expect(clone.bech32Prefix).toStrictEqual(ref.bech32Prefix);
1723

@@ -21,6 +27,9 @@ describe('de/serialize', () => {
2127
expect(code2.creator).toStrictEqual('bob');
2228
expect(toBase64(code1.wasmCode)).toStrictEqual(toBase64(ref.wasm.store.getObject('codes', 1, 'wasmCode')));
2329
expect(toBase64(code2.wasmCode)).toStrictEqual(toBase64(ref.wasm.store.getObject('codes', 2, 'wasmCode')));
30+
31+
let result = await clone.wasm.executeContract('alice', [], address, { debug: { msg: 'foobar' }});
32+
expect(result.ok).toBeTruthy();
2433
}
2534
})
2635
})

0 commit comments

Comments
 (0)