Files
monero_c/tests/regression.test.ts
Mateusz Franik 85770ea6f1 tests: run integration and regression tests on other platforms (#93)
* tests: add script to download test dependencies from fallback mirrors

* tests: use the new download_deps script, run tests on macos

* ci: download proper artifact for macos

* chore: make download_deps script download everything to dir named `monero_c` when ran directly

* tests: await downloading deps

* tests download  proper monero_c version in prepareMoneroC

* tests: fix typos

* tests: add file data for more targets

* tests: print why retrieving tags failed

* chore: change mirror url endpoint from `monero_c` to `download_mirror`

* tests: use cached releases endpoint to prevent ratelimits

* ci: remove brew@1.76 dependency

* tests: fix macos dylib path

* feat!(monero.ts): make `createTransactionMultDest` optionally return `null`

* feat(monero.ts): make `Wallet_reconnectDevice` symbol optional

* tests: don't try to extract file if out already exists

* tests: remove unnecesary directory rm calls

* ci: set regression tests to use canary
2024-12-30 10:39:28 +01:00

37 lines
1.4 KiB
TypeScript
Executable File

import { $, createWalletViaCli, getMoneroCTags, prepareCli, prepareMoneroC } 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([prepareMoneroC(coin, "next"), await prepareMoneroC(coin, latestTag), prepareCli(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 prepareMoneroC(coin, version);
await $`deno run -A ./tests/compare.ts ${coin} ${version} ${JSON.stringify(walletInfo)}`;
}
});
await Deno.remove("./tests/wallets", { recursive: true }).catch(() => {});
});