Move test-specific code into the testing function.

This commit is contained in:
Danila Fedorin 2021-07-12 13:31:33 -07:00
parent fd17ffecfb
commit 1e9cdbafd4

View file

@ -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 {