9
9
}
10
10
11
11
const assert = require ( 'assert' ) ;
12
- const { readFile } = require ( 'fs' ) ;
12
+ const { readFileSync } = require ( 'fs' ) ;
13
13
const fixtures = require ( '../common/fixtures' ) ;
14
14
const { replaceLinks } = require ( '../../tools/doc/markdown.js' ) ;
15
15
const html = require ( '../../tools/doc/html.js' ) ;
@@ -58,11 +58,6 @@ function toHTML({ input, filename, nodeVersion, versions }) {
58
58
// This HTML will be stripped of all whitespace because we don't currently
59
59
// have an HTML parser.
60
60
const testData = [
61
- {
62
- file : fixtures . path ( 'sample_document.md' ) ,
63
- html : '<ol><li>fish</li><li>fish</li></ol>' +
64
- '<ul><li>Redfish</li><li>Bluefish</li></ul>'
65
- } ,
66
61
{
67
62
file : fixtures . path ( 'order_of_end_tags_5873.md' ) ,
68
63
html : '<h3>Static method: Buffer.from(array) <span> ' +
@@ -126,6 +121,10 @@ const testData = [
126
121
'href="#foo_see_also" id="foo_see_also">#</a></span></h2><p>Check' +
127
122
'out also<a href="https://nodejs.org/">this guide</a></p>'
128
123
} ,
124
+ {
125
+ file : fixtures . path ( 'document_with_special_heading.md' ) ,
126
+ html : '<title>Sample markdown with special heading |' ,
127
+ }
129
128
] ;
130
129
131
130
const spaces = / \s / g;
@@ -144,17 +143,16 @@ testData.forEach(({ file, html }) => {
144
143
// Normalize expected data by stripping whitespace.
145
144
const expected = html . replace ( spaces , '' ) ;
146
145
147
- readFile ( file , 'utf8' , common . mustCall ( async ( err , input ) => {
148
- assert . ifError ( err ) ;
149
- const output = toHTML ( { input : input ,
150
- filename : 'foo' ,
151
- nodeVersion : process . version ,
152
- versions : versions } ) ;
146
+ const input = readFileSync ( file , 'utf8' ) ;
147
+
148
+ const output = toHTML ( { input,
149
+ filename : 'foo' ,
150
+ nodeVersion : process . version ,
151
+ versions } ) ;
153
152
154
- const actual = output . replace ( spaces , '' ) ;
155
- // Assert that the input stripped of all whitespace contains the
156
- // expected markup.
157
- assert ( actual . includes ( expected ) ,
158
- `ACTUAL: ${ actual } \nEXPECTED: ${ expected } ` ) ;
159
- } ) ) ;
153
+ const actual = output . replace ( spaces , '' ) ;
154
+ // Assert that the input stripped of all whitespace contains the
155
+ // expected markup.
156
+ assert ( actual . includes ( expected ) ,
157
+ `ACTUAL: ${ actual } \nEXPECTED: ${ expected } ` ) ;
160
158
} ) ;
0 commit comments