Move test-specific code into the testing function.
This commit is contained in:
parent
fd17ffecfb
commit
1e9cdbafd4
1 changed files with 43 additions and 43 deletions
|
@ -174,7 +174,8 @@ export function parseHTMLBody(platform, mediaRepository, html) {
|
|||
|
||||
import parse from '../../../../../lib/node-html-parser/index.js';
|
||||
|
||||
export class HTMLParseResult {
|
||||
export function tests() {
|
||||
class HTMLParseResult {
|
||||
constructor(bodyNode) {
|
||||
this._bodyNode = bodyNode;
|
||||
}
|
||||
|
@ -210,15 +211,14 @@ export class HTMLParseResult {
|
|||
getNodeElementName(node) {
|
||||
return node.tagName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const platform = {
|
||||
const platform = {
|
||||
parseHTML: (html) => new HTMLParseResult(parse(html))
|
||||
};
|
||||
};
|
||||
|
||||
export function tests() {
|
||||
function test(assert, input, output) {
|
||||
assert.deepEqual(parseHTMLBody({ mediaRepository: null, platform }, input), new MessageBody(input, output));
|
||||
assert.deepEqual(parseHTMLBody(platform, null, input), new MessageBody(input, output));
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
Reference in a new issue