1 | import fs from "node:fs";
|
2 |
|
3 | import { afterEach, beforeAll, describe, expect, it } from "vitest";
|
4 |
|
5 | import request from "./request.js";
|
6 | import util from "./util.js";
|
7 |
|
8 | describe("get/request", function () {
|
9 |
|
10 | let url = "https://raw.githubusercontent.com/nwutils/nw-builder/main/src/util/osx.arm.versions.json"
|
11 | const filePath = "./test/fixture/request.test.json";
|
12 |
|
13 | afterEach(async function () {
|
14 | await fs.promises.rm(filePath, { force: true });
|
15 | });
|
16 |
|
17 | beforeAll(async function () {
|
18 | await fs.promises.mkdir('./test/fixture', { recursive: true });
|
19 | });
|
20 |
|
21 | it("downloads from specific url", async function () {
|
22 | await request(url, filePath);
|
23 | expect(util.fileExists(filePath)).resolves.toBe(true);
|
24 | }, Infinity);
|
25 | });
|