-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.cjs
More file actions
41 lines (34 loc) · 1.3 KB
/
index.test.cjs
File metadata and controls
41 lines (34 loc) · 1.3 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
41
// Minimal CommonJS test stub
const { fs, log, path, pathUrl, getCurrentDirname, getCurrentFilename, registerHandlers, registerSignals } = require('./index.cjs');
const { test, expect } = require('@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(__dirname, 'foo');
expect(result).toContain('foo');
});
test('pathUrl should join paths', () => {
const result = pathUrl(__dirname, 'foo');
expect(result).toContain('foo');
});
test('getCurrentDirname should return a string', () => {
expect(typeof getCurrentDirname(__dirname)).toBe('string');
});
test('getCurrentFilename should return a string', () => {
expect(typeof getCurrentFilename(__filename)).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');
});