cosmwasm/test: add integration tests

This commit is contained in:
Paul Noel 2022-09-22 20:42:07 +00:00 committed by Paul Noel
parent c22d0c222b
commit eb42bc48e7
3 changed files with 1227 additions and 782 deletions

View File

@ -64,10 +64,10 @@ unit-test:
## Run unit and integration tests
test: artifacts test/node_modules LocalTerra unit-test
@if pgrep terrad; then echo "Error: terrad already running. Stop it before running tests"; exit 1; fi
cd LocalTerra && docker compose up --detach
cd LocalTerra && docker-compose up --detach
sleep 5
cd test && npm run test || (cd ../LocalTerra && docker compose down && exit 1)
cd LocalTerra && docker compose down
cd test && npm run test || (cd ../LocalTerra && docker-compose down && exit 1)
cd LocalTerra && docker-compose down
.PHONY: clean
clean:

File diff suppressed because it is too large Load Diff

View File

@ -49,3 +49,26 @@ export async function deploy(
// @ts-ignore
return /"_contract_address","value":"([^"]+)/gm.exec(receipt.raw_log)[1];
}
export async function deployWithCodeID(
terra: LCDClient,
wallet: Wallet,
instantiateMsg: Object,
label: string,
codeId: number
): Promise<string> {
const msgs = [
new MsgInstantiateContract(
wallet.key.accAddress,
wallet.key.accAddress,
codeId,
instantiateMsg,
undefined,
label
),
];
const receipt = await transactWithoutMemo(terra, wallet, msgs);
// @ts-ignore
return /"_contract_address","value":"([^"]+)/gm.exec(receipt.raw_log)[1];
}