-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.js
28 lines (20 loc) · 774 Bytes
/
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
27
28
import path from 'node:path';
import {promises as fs} from 'node:fs';
import test from 'ava';
import quibble from 'quibble';
test.serial('ensure the returned filepath is not a symlink', async t => {
await quibble.esm('os', {}, {
tmpdir: () => path.resolve('fixture-symlink'),
});
const {default: temporaryDirectory} = await import('./index.js');
const filePath = path.join(temporaryDirectory, 'unicorn');
await fs.writeFile(filePath, '🦄');
t.is(filePath, await fs.realpath(filePath));
t.is(await fs.readFile(filePath, {encoding: 'utf8'}), '🦄');
await fs.unlink(filePath);
await quibble.reset();
});
test.serial('main', async t => {
const {default: temporaryDirectory} = await import('./index.js');
t.true(path.isAbsolute(temporaryDirectory));
});