Files
monero_c/tests/regression.test.ts
Mateusz Franik fd7bb6ae1c feat: wownero typescript bindings, regression tests (#71)
* regression tests
* ci: move regression_check to full_check workflow, reuse artifact build
* feat: support wownero in monero.ts bindings
* ci: test wownero regressions as well
* extract wownero-cli as wownero
* actually load wownero when specified
* fix: commitUR not being a symbol in wownero
2024-10-16 07:55:11 +02:00

40 lines
1.5 KiB
TypeScript
Executable File

import { $, createWalletViaCli, downloadCli, getMoneroC, getMoneroCTags } from "./utils.ts";
const coin = Deno.env.get("COIN");
if (coin !== "monero" && coin !== "wownero") {
throw new Error("COIN env var invalid or missing");
}
Deno.test(`Regression tests (${coin})`, async (t) => {
await Deno.remove("./tests/wallets", { recursive: true }).catch(() => {});
await Deno.mkdir("./tests/wallets", { recursive: true });
const tags = await getMoneroCTags();
const latestTag = tags[0];
await Promise.all([getMoneroC(coin, "next"), await getMoneroC(coin, latestTag), downloadCli(coin)]);
await t.step("Simple (next, latest, next)", async () => {
const walletInfo = await createWalletViaCli(coin, "dog", "sobaka");
for (const version of ["next", latestTag, "next"]) {
await $`deno run -A ./tests/compare.ts ${coin} ${version} ${JSON.stringify(walletInfo)}`;
}
});
await t.step("All releases sequentially (all tags in the release order, next)", async () => {
tags.unshift("next");
const walletInfo = await createWalletViaCli(coin, "cat", "koshka");
for (const version of tags.toReversed()) {
if (version !== "next" && version !== tags[0]) await getMoneroC(coin, version);
await $`deno run -A ./tests/compare.ts ${coin} ${version} ${JSON.stringify(walletInfo)}`;
}
await Deno.remove("./tests/wallets", { recursive: true }).catch(() => {});
});
await Deno.remove("./tests/wallets", { recursive: true }).catch(() => {});
await Deno.remove("./tests/libs", { recursive: true }).catch(() => {});
});