test: refactor doctool tests
Adjust style in doctool tests to conform with predominant style of the rest of the project. The biggest changes are: * Replace string concatenation with `path.join()` * Remove unnecessary quotes from property names PR-URL: https://github.com/nodejs/node/pull/6719 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
32b46d91a7
commit
9bc72ea0de
@ -3,6 +3,7 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
const html = require('../../tools/doc/html.js');
|
const html = require('../../tools/doc/html.js');
|
||||||
|
|
||||||
@ -13,13 +14,13 @@ const html = require('../../tools/doc/html.js');
|
|||||||
// have an html parser.
|
// have an html parser.
|
||||||
const testData = [
|
const testData = [
|
||||||
{
|
{
|
||||||
'file': common.fixturesDir + '/sample_document.md',
|
file: path.join(common.fixturesDir, 'sample_document.md'),
|
||||||
'html': '<ol><li>fish</li><li><p>fish</p></li><li><p>Redfish</p></li>' +
|
html: '<ol><li>fish</li><li><p>fish</p></li><li><p>Redfish</p></li>' +
|
||||||
'<li>Bluefish</li></ol>'
|
'<li>Bluefish</li></ol>'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'file': common.fixturesDir + '/order_of_end_tags_5873.md',
|
file: path.join(common.fixturesDir, 'order_of_end_tags_5873.md'),
|
||||||
'html': '<h3>ClassMethod: Buffer.from(array) <span> ' +
|
html: '<h3>ClassMethod: Buffer.from(array) <span> ' +
|
||||||
'<a class="mark" href="#foo_class_method_buffer_from_array" ' +
|
'<a class="mark" href="#foo_class_method_buffer_from_array" ' +
|
||||||
'id="foo_class_method_buffer_from_array">#</a> </span> </h3><div' +
|
'id="foo_class_method_buffer_from_array">#</a> </span> </h3><div' +
|
||||||
'class="signature"><ul><li><code>array</code><a ' +
|
'class="signature"><ul><li><code>array</code><a ' +
|
||||||
@ -28,8 +29,8 @@ const testData = [
|
|||||||
'</ul></div>'
|
'</ul></div>'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'file': common.fixturesDir + '/doc_with_yaml.md',
|
file: path.join(common.fixturesDir, 'doc_with_yaml.md'),
|
||||||
'html': '<h1>Sample Markdown with YAML info' +
|
html: '<h1>Sample Markdown with YAML info' +
|
||||||
'<span><a class="mark" href="#foo_sample_markdown_with_yaml_info" ' +
|
'<span><a class="mark" href="#foo_sample_markdown_with_yaml_info" ' +
|
||||||
' id="foo_sample_markdown_with_yaml_info">#</a></span></h1>' +
|
' id="foo_sample_markdown_with_yaml_info">#</a></span></h1>' +
|
||||||
'<h2>Foobar<span><a class="mark" href="#foo_foobar" ' +
|
'<h2>Foobar<span><a class="mark" href="#foo_foobar" ' +
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
const json = require('../../tools/doc/json.js');
|
const json = require('../../tools/doc/json.js');
|
||||||
|
|
||||||
@ -12,113 +13,116 @@ const json = require('../../tools/doc/json.js');
|
|||||||
// 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 = [
|
var testData = [
|
||||||
{
|
{
|
||||||
'file': common.fixturesDir + '/sample_document.md',
|
file: path.join(common.fixturesDir, 'sample_document.md'),
|
||||||
'json': {
|
json: {
|
||||||
'source': 'foo',
|
source: 'foo',
|
||||||
'modules': [ { 'textRaw': 'Sample Markdown',
|
modules: [{
|
||||||
'name': 'sample_markdown',
|
textRaw: 'Sample Markdown',
|
||||||
'modules': [ { 'textRaw': 'Seussian Rhymes',
|
name: 'sample_markdown',
|
||||||
'name': 'seussian_rhymes',
|
modules: [{
|
||||||
'desc': '<ol>\n<li>fish</li>\n<li><p>fish</p>\n</li>\n<li>' +
|
textRaw: 'Seussian Rhymes',
|
||||||
|
name: 'seussian_rhymes',
|
||||||
|
desc: '<ol>\n<li>fish</li>\n<li><p>fish</p>\n</li>\n<li>' +
|
||||||
'<p>Red fish</p>\n</li>\n<li>Blue fish</li>\n</ol>\n',
|
'<p>Red fish</p>\n</li>\n<li>Blue fish</li>\n</ol>\n',
|
||||||
'type': 'module',
|
type: 'module',
|
||||||
'displayName': 'Seussian Rhymes'
|
displayName: 'Seussian Rhymes'
|
||||||
} ],
|
}],
|
||||||
'type': 'module',
|
type: 'module',
|
||||||
'displayName': 'Sample Markdown'
|
displayName: 'Sample Markdown'
|
||||||
} ]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'file': common.fixturesDir + '/order_of_end_tags_5873.md',
|
file: path.join(common.fixturesDir, 'order_of_end_tags_5873.md'),
|
||||||
'json': {
|
json: {
|
||||||
'source': 'foo',
|
source: 'foo',
|
||||||
'modules': [ {
|
modules: [{
|
||||||
'textRaw': 'Title',
|
textRaw: 'Title',
|
||||||
'name': 'title',
|
name: 'title',
|
||||||
'modules': [ {
|
modules: [{
|
||||||
'textRaw': 'Subsection',
|
textRaw: 'Subsection',
|
||||||
'name': 'subsection',
|
name: 'subsection',
|
||||||
'classMethods': [ {
|
classMethods: [{
|
||||||
'textRaw': 'Class Method: Buffer.from(array)',
|
textRaw: 'Class Method: Buffer.from(array)',
|
||||||
'type': 'classMethod',
|
type: 'classMethod',
|
||||||
'name': 'from',
|
name: 'from',
|
||||||
'signatures': [ {
|
signatures: [
|
||||||
'params': [ {
|
{
|
||||||
'textRaw': '`array` {Array} ',
|
params: [{
|
||||||
'name': 'array',
|
textRaw: '`array` {Array} ',
|
||||||
'type': 'Array'
|
name: 'array',
|
||||||
} ]
|
type: 'Array'
|
||||||
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'params': [ {
|
params: [{
|
||||||
'name': 'array'
|
name: 'array'
|
||||||
} ]
|
}]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
} ],
|
}],
|
||||||
'type': 'module',
|
type: 'module',
|
||||||
'displayName': 'Subsection'
|
displayName: 'Subsection'
|
||||||
} ],
|
}],
|
||||||
'type': 'module',
|
type: 'module',
|
||||||
'displayName': 'Title'
|
displayName: 'Title'
|
||||||
} ]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'file': common.fixturesDir + '/doc_with_yaml.md',
|
file: path.join(common.fixturesDir, 'doc_with_yaml.md'),
|
||||||
'json': {
|
json: {
|
||||||
'source': 'foo',
|
source: 'foo',
|
||||||
'modules': [
|
modules: [
|
||||||
{
|
{
|
||||||
'textRaw': 'Sample Markdown with YAML info',
|
textRaw: 'Sample Markdown with YAML info',
|
||||||
'name': 'sample_markdown_with_yaml_info',
|
name: 'sample_markdown_with_yaml_info',
|
||||||
'modules': [
|
modules: [
|
||||||
{
|
{
|
||||||
'textRaw': 'Foobar',
|
textRaw: 'Foobar',
|
||||||
'name': 'foobar',
|
name: 'foobar',
|
||||||
'meta': {
|
meta: {
|
||||||
'added': ['v1.0.0']
|
added: ['v1.0.0']
|
||||||
},
|
},
|
||||||
'desc': '<p>Describe <code>Foobar</code> in more detail ' +
|
desc: '<p>Describe <code>Foobar</code> in more detail ' +
|
||||||
'here.</p>\n',
|
'here.</p>\n',
|
||||||
'type': 'module',
|
type: 'module',
|
||||||
'displayName': 'Foobar'
|
displayName: 'Foobar'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'textRaw': 'Foobar II',
|
textRaw: 'Foobar II',
|
||||||
'name': 'foobar_ii',
|
name: 'foobar_ii',
|
||||||
'meta': {
|
meta: {
|
||||||
'added': ['v5.3.0', 'v4.2.0']
|
added: ['v5.3.0', 'v4.2.0']
|
||||||
},
|
},
|
||||||
'desc': '<p>Describe <code>Foobar II</code> in more detail ' +
|
desc: '<p>Describe <code>Foobar II</code> in more detail ' +
|
||||||
'here.</p>\n',
|
'here.</p>\n',
|
||||||
'type': 'module',
|
type: 'module',
|
||||||
'displayName': 'Foobar II'
|
displayName: 'Foobar II'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'textRaw': 'Deprecated thingy',
|
textRaw: 'Deprecated thingy',
|
||||||
'name': 'deprecated_thingy',
|
name: 'deprecated_thingy',
|
||||||
'meta': {
|
meta: {
|
||||||
'added': ['v1.0.0'],
|
added: ['v1.0.0'],
|
||||||
'deprecated': ['v2.0.0']
|
deprecated: ['v2.0.0']
|
||||||
},
|
},
|
||||||
'desc': '<p>Describe <code>Deprecated thingy</code> in more ' +
|
desc: '<p>Describe <code>Deprecated thingy</code> in more ' +
|
||||||
'detail here.</p>\n',
|
'detail here.</p>\n',
|
||||||
'type': 'module',
|
type: 'module',
|
||||||
'displayName': 'Deprecated thingy'
|
displayName: 'Deprecated thingy'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'textRaw': 'Something',
|
textRaw: 'Something',
|
||||||
'name': 'something',
|
name: 'something',
|
||||||
'desc': '<!-- This is not a metadata comment -->\n<p>' +
|
desc: '<!-- This is not a metadata comment -->\n<p>' +
|
||||||
'Describe <code>Something</code> in more detail here.</p>\n',
|
'Describe <code>Something</code> in more detail here.</p>\n',
|
||||||
'type': 'module',
|
type: 'module',
|
||||||
'displayName': 'Something'
|
displayName: 'Something'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'type': 'module',
|
type: 'module',
|
||||||
'displayName': 'Sample Markdown with YAML info'
|
displayName: 'Sample Markdown with YAML info'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user