-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.mjs
More file actions
40 lines (33 loc) · 1.27 KB
/
index.test.mjs
File metadata and controls
40 lines (33 loc) · 1.27 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
import { fs, log, path, pathUrl, getCurrentDirname, getCurrentFilename, registerHandlers, registerSignals } from './index.mjs';
import { test, expect } from '@jest/globals';
test('fs should be defined', () => {
expect(fs).toBeDefined();
expect(typeof fs.readFile).toBe('function');
});
test('log should be defined', () => {
expect(log).toBeDefined();
expect(typeof log.info).toBe('function');
});
test('path should join paths', () => {
const result = path(import.meta, 'foo');
expect(result).toContain('foo');
});
test('pathUrl should join paths', () => {
const result = pathUrl(import.meta, 'foo');
expect(result).toContain('foo');
});
test('getCurrentDirname should return a string', () => {
expect(typeof getCurrentDirname(import.meta)).toBe('string');
});
test('getCurrentFilename should return a string', () => {
expect(typeof getCurrentFilename(import.meta)).toBe('string');
});
test('registerHandlers returns removeHandlers', () => {
const { removeHandlers } = registerHandlers();
expect(typeof removeHandlers).toBe('function');
});
test('registerSignals returns shutdown and getShuttingDown', () => {
const { shutdown, getShuttingDown } = registerSignals();
expect(typeof shutdown).toBe('function');
expect(typeof getShuttingDown).toBe('function');
});