|
1 | 1 | import assert from 'node:assert/strict'; |
2 | 2 | import { describe, it } from 'node:test'; |
3 | 3 |
|
4 | | -import remarkParse from 'remark-parse'; |
5 | | -import remarkStringify from 'remark-stringify'; |
6 | | -import { unified } from 'unified'; |
7 | | - |
8 | 4 | import { SAMPLE } from './utils.mjs'; |
9 | | -import { AST_NODE_TYPES } from '../../constants.mjs'; |
| 5 | +import { JSX_IMPORTS } from '../../../web/constants.mjs'; |
10 | 6 | import buildContent from '../buildContent.mjs'; |
11 | 7 |
|
12 | 8 | describe('buildContent', () => { |
13 | 9 | it('should process entries and include JSX wrapper elements', () => { |
14 | | - const processor = unified().use(remarkParse).use(remarkStringify); |
15 | | - const tree = buildContent([SAMPLE], SAMPLE, {}, processor); |
16 | | - |
17 | | - const article = tree.children.find( |
18 | | - child => child.name === AST_NODE_TYPES.JSX.ARTICLE |
| 10 | + const tree = buildContent( |
| 11 | + [SAMPLE], |
| 12 | + SAMPLE, |
| 13 | + {}, |
| 14 | + { |
| 15 | + runSync: x => ({ |
| 16 | + body: [{ expression: x }], |
| 17 | + }), |
| 18 | + } |
19 | 19 | ); |
20 | | - assert.ok(article); |
21 | | - assert.ok( |
22 | | - article.children.some(c => c.name === AST_NODE_TYPES.JSX.SIDE_BAR) |
| 20 | + |
| 21 | + assert.deepStrictEqual( |
| 22 | + tree.children.map(child => child.name), |
| 23 | + [JSX_IMPORTS.NavBar.name, JSX_IMPORTS.Article.name] |
23 | 24 | ); |
24 | | - assert.ok(article.children.some(c => c.name === AST_NODE_TYPES.JSX.FOOTER)); |
| 25 | + assert.equal(tree.data, SAMPLE); |
25 | 26 | }); |
26 | 27 | }); |
0 commit comments