Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5f724cc

Browse files
committedFeb 6, 2022
test: add tests to check exports are functions
1 parent 1d9ab19 commit 5f724cc

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
 

‎index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var htmlToDOM = require('html-dom-parser');
44

55
// support backwards compatibility for ES Module
66
htmlToDOM =
7+
/* istanbul ignore next */
78
typeof htmlToDOM.default === 'function' ? htmlToDOM.default : htmlToDOM;
89

910
var domParserOptions = { lowerCaseAttributeNames: false };

‎test/index.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,23 @@ const { render } = require('./helpers');
66
describe('module', () => {
77
it('exports default', () => {
88
expect(parse.default).toBe(parse);
9+
expect(parse.default).toBeInstanceOf(Function);
910
});
1011

1112
it('exports domToReact', () => {
1213
expect(parse.domToReact).toBe(require('../lib/dom-to-react'));
14+
expect(parse.domToReact).toBeInstanceOf(Function);
1315
});
1416

1517
it('exports htmlToDOM', () => {
1618
expect(parse.htmlToDOM).toBe(require('html-dom-parser'));
19+
expect(parse.htmlToDOM).toBeInstanceOf(Function);
20+
expect(parse.htmlToDOM.default).toBe(undefined);
1721
});
1822

1923
it('exports attributesToProps', () => {
2024
expect(parse.attributesToProps).toBe(require('../lib/attributes-to-props'));
25+
expect(parse.attributesToProps).toBeInstanceOf(Function);
2126
});
2227
});
2328

0 commit comments

Comments
 (0)
Please sign in to comment.