forked from cheeriojs/cheerio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.spec.ts
29 lines (25 loc) · 956 Bytes
/
index.spec.ts
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
import * as cheerio from './index.js';
import * as statics from './static.js';
describe('static method re-exports', () => {
it('should export expected static methods', () => {
for (const key of Object.keys(statics) as (keyof typeof statics)[]) {
if (key === 'extract') continue;
expect(typeof cheerio[key]).toBe(typeof statics[key]);
}
});
it('should have a functional `html` that is bound to the default instance', () => {
expect(cheerio.html(cheerio.default('<div>test div</div>'))).toBe(
'<div>test div</div>',
);
});
it('should have a functional `xml` that is bound to the default instance', () => {
expect(cheerio.xml(cheerio.default('<div>test div</div>'))).toBe(
'<div>test div</div>',
);
});
it('should have a functional `text` that is bound to the default instance', () => {
expect(cheerio.text(cheerio.default('<div>test div</div>'))).toBe(
'test div',
);
});
});