feat: add link module
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { Android, AndroidNdk, FlashPlayer, Haxe, Neko, resolveLink, RufflePlayer } 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(new Neko().link, [
|
||||
[{ 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(new Haxe().link, [
|
||||
[{ os_name: "linux" }, "https://github.com/HaxeFoundation/haxe/releases/download/4.2.5/haxe-4.2.5-linux64.tar.gz"],
|
||||
[{ os_name: "win" }, "https://github.com/HaxeFoundation/haxe/releases/download/4.2.5/haxe-4.2.5-win64.zip"],
|
||||
]));
|
||||
|
||||
test("flashplayer", () =>
|
||||
testLink(new FlashPlayer().link, [
|
||||
[
|
||||
{ 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("ruffle", () =>
|
||||
testLink(new RufflePlayer().link, [
|
||||
[
|
||||
{ os_name: "linux" },
|
||||
"https://github.com/ruffle-rs/ruffle/releases/download/v0.7.1/ruffle-0.7.1-linux-x86_64.tar.gz",
|
||||
],
|
||||
[
|
||||
{ os_name: "win" },
|
||||
"https://github.com/ruffle-rs/ruffle/releases/download/v0.7.1/ruffle-0.7.1-windows-x86_64.zip",
|
||||
],
|
||||
]));
|
||||
|
||||
test("android", () =>
|
||||
testLink(new Android().link, [
|
||||
[{ 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"],
|
||||
]));
|
||||
|
||||
test("android-ndk", () =>
|
||||
testLink(new AndroidNdk().link, [
|
||||
[{ os_name: "linux" }, "https://dl.google.com/android/repository/android-ndk-r21e-linux-x86_64.zip"],
|
||||
[{ os_name: "win" }, "https://dl.google.com/android/repository/android-ndk-r21e-windows-x86_64.zip"],
|
||||
]));
|
||||
Reference in New Issue
Block a user