import assert from "node:assert/strict"; import test from "node:test"; import { AndroidLink, FlashplayerLink, HaxeLink, NekoLink, resolveLink } from "../dist/lib/index.mjs"; const testLink = (link, args) => { for (const [params, targetUrl] of args) { const url = resolveLink(link, params); assert.equal(url, targetUrl); } }; test("neko", () => testLink(NekoLink, [ [{ os_name: "linux" }, "https://github.com/HaxeFoundation/neko/releases/download/v2-4-1/neko-2.4.1-linux64.tar.gz"], [{ os_name: "win" }, "https://github.com/HaxeFoundation/neko/releases/download/v2-4-1/neko-2.4.1-win64.zip"], ])); test("haxe", () => testLink(HaxeLink, [ [{ os_name: "linux" }, "https://github.com/HaxeFoundation/haxe/releases/download/3.4.2/haxe-3.4.2-linux64.tar.gz"], [{ os_name: "win" }, "https://github.com/HaxeFoundation/haxe/releases/download/3.4.2/haxe-3.4.2-win64.zip"], ])); test("flashplayer", () => testLink(FlashplayerLink, [ [ { os_name: "linux" }, "https://fpdownload.macromedia.com/pub/flashplayer/updaters/32/flash_player_sa_linux.x86_64.tar.gz", ], [{ os_name: "win" }, "https://fpdownload.macromedia.com/pub/flashplayer/updaters/32/flashplayer_32_sa.exe"], ])); test("android", () => testLink(AndroidLink, [ [{ os_name: "linux" }, "https://dl.google.com/android/repository/commandlinetools-linux-7302050_latest.zip"], [{ os_name: "win" }, "https://dl.google.com/android/repository/commandlinetools-win-7302050_latest.zip"], ]));