Files
gulp-haxetool/test/download.test.js
T
shmyga 68bb39f09a
test / test (push) Successful in 6m32s
feat: add link module
2026-11-05 23:43:28 +03:00

19 lines
742 B
JavaScript

import assert from "node:assert/strict";
import { existsSync, mkdtempSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import test from "node:test";
import { download } from "../dist/lib/index.mjs";
const testUrl = async (url, file) => {
const target = mkdtempSync(join(tmpdir(), "test-"));
await download(url, target);
assert(existsSync(join(target, file)));
};
test("zip", async () => await testUrl("https://home.shmyga.ru/public/sdk/haxe/haxe-4.2.5-win.zip", "haxe.exe"));
test("tar.gz", async () => await testUrl("https://home.shmyga.ru/public/sdk/haxe/haxe-4.2.5-linux64.tar.gz", "haxe"));
test("plain", async () => await testUrl("https://home.shmyga.ru/public/test.txt", "test.txt"));