-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
run.test.js
26 lines (23 loc) · 986 Bytes
/
run.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import extract from 'extract-zip';
import { chmodSync, existsSync, statSync, unlinkSync } from 'node:fs';
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { afterAll, expect, it } from 'vitest';
import download from './utils/download.js';
const dir = dirname(fileURLToPath(import.meta.url));
it('should download and extract the patcher', async () => {
await download(
'https://github.com/CzBiX/WSLHostPatcher/releases/latest/download/WSLHostPatcher.zip',
`${dir}/WSLHostPatcher.zip`
);
await extract(`${dir}/WSLHostPatcher.zip`, { dir });
chmodSync(`${dir}/WSLHostPatcher.exe`, 0o755);
expect(existsSync(`${dir}/WSLHostPatch.dll`)).toBe(true);
expect(existsSync(`${dir}/WSLHostPatcher.exe`)).toBe(true);
expect(statSync(`${dir}/WSLHostPatcher.exe`).mode).toBe(0o0100755);
});
afterAll(() => {
unlinkSync(`${dir}/WSLHostPatcher.zip`);
unlinkSync(`${dir}/WSLHostPatch.dll`);
unlinkSync(`${dir}/WSLHostPatcher.exe`);
});