-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathexports.test.js
More file actions
66 lines (50 loc) · 2.45 KB
/
exports.test.js
File metadata and controls
66 lines (50 loc) · 2.45 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* Tests for package exports
* Verifies that all public APIs are accessible via index.js
*/
import { describe, it } from 'node:test';
import assert from 'node:assert';
describe('Package Exports', () => {
it('should export core analyzer functions', async () => {
const capo = await import('../src/index.js');
assert.ok(capo.analyzeHead, 'Should export analyzeHead');
assert.ok(capo.analyzeHeadWithOrdering, 'Should export analyzeHeadWithOrdering');
assert.ok(capo.checkOrdering, 'Should export checkOrdering');
assert.ok(capo.getWeightCategory, 'Should export getWeightCategory');
});
it('should export rules API', async () => {
const capo = await import('../src/index.js');
assert.ok(capo.ElementWeights, 'Should export ElementWeights');
assert.ok(capo.getWeight, 'Should export getWeight');
assert.ok(capo.getHeadWeights, 'Should export getHeadWeights');
assert.ok(capo.isMeta, 'Should export isMeta');
assert.ok(capo.isTitle, 'Should export isTitle');
});
it('should export validation API', async () => {
const capo = await import('../src/index.js');
assert.ok(capo.VALID_HEAD_ELEMENTS, 'Should export VALID_HEAD_ELEMENTS');
assert.ok(capo.isValidElement, 'Should export isValidElement');
assert.ok(capo.hasValidationWarning, 'Should export hasValidationWarning');
assert.ok(capo.getValidationWarnings, 'Should export getValidationWarnings');
assert.ok(capo.getCustomValidations, 'Should export getCustomValidations');
});
it('should export adapters', async () => {
const capo = await import('../src/index.js');
assert.ok(capo.BrowserAdapter, 'Should export BrowserAdapter');
assert.ok(capo.AdapterInterface, 'Should export AdapterInterface');
assert.ok(capo.validateAdapter, 'Should export validateAdapter');
});
it('should work with named imports', async () => {
const { analyzeHead, BrowserAdapter } = await import('../src/index.js');
assert.strictEqual(typeof analyzeHead, 'function');
assert.strictEqual(typeof BrowserAdapter, 'function');
});
it('should support subpath exports - core', async () => {
const core = await import('../src/analyzer.js');
assert.ok(core.analyzeHead, 'Core export should work');
});
it('should support subpath exports - adapters', async () => {
const adapters = await import('../src/adapters/index.js');
assert.ok(adapters.BrowserAdapter, 'Adapters export should work');
});
});