test: refactor test-doctool-html.js
PR-URL: https://github.com/nodejs/node/pull/10696 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
parent
85a90340e1
commit
c61d9bade0
@ -74,7 +74,7 @@ const testData = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
testData.forEach(function(item) {
|
testData.forEach((item) => {
|
||||||
// Normalize expected data by stripping whitespace
|
// Normalize expected data by stripping whitespace
|
||||||
const expected = item.html.replace(/\s/g, '');
|
const expected = item.html.replace(/\s/g, '');
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ const json = require('../../tools/doc/json.js');
|
|||||||
// Test data is a list of objects with two properties.
|
// Test data is a list of objects with two properties.
|
||||||
// The file property is the file path.
|
// The file property is the file path.
|
||||||
// The json property is some json which will be generated by the doctool.
|
// The json property is some json which will be generated by the doctool.
|
||||||
var testData = [
|
const testData = [
|
||||||
{
|
{
|
||||||
file: path.join(common.fixturesDir, 'sample_document.md'),
|
file: path.join(common.fixturesDir, 'sample_document.md'),
|
||||||
json: {
|
json: {
|
||||||
@ -136,10 +136,10 @@ var testData = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
testData.forEach(function(item) {
|
testData.forEach((item) => {
|
||||||
fs.readFile(item.file, 'utf8', common.mustCall(function(err, input) {
|
fs.readFile(item.file, 'utf8', common.mustCall((err, input) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
json(input, 'foo', common.mustCall(function(err, output) {
|
json(input, 'foo', common.mustCall((err, output) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.deepStrictEqual(output, item.json);
|
assert.deepStrictEqual(output, item.json);
|
||||||
}));
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user