Skip to content

Commit 223a1a6

Browse files
test(html): assert the whole facade surface, not two names of it
The surface test read `parseHtml` and `NodeType`, leaving the other 33 getters unexecuted. Walk every published name instead: each resolves to a defined value, and each one the parser half spells the same way is identical to it.
1 parent 3b05a73 commit 223a1a6

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

‎test/unitCases/HtmlSyntax.unittest.js‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3235,8 +3235,26 @@ describe("HtmlSyntax — the facade", () => {
32353235
});
32363236

32373237
it("takes every name it publishes from the half that owns it", () => {
3238-
expect(syntax.parseHtml).toBe(syntax.parser.parseHtml);
3239-
expect(syntax.NodeType).toBe(syntax.parser.NodeType);
3238+
const parser = /** @type {Record<string, unknown>} */ (
3239+
/** @type {unknown} */ (syntax.parser)
3240+
);
3241+
const surface = /** @type {Record<string, unknown>} */ (
3242+
/** @type {unknown} */ (syntax)
3243+
);
3244+
const published = Object.keys(surface).filter(
3245+
(name) =>
3246+
name !== "parser" && name !== "printer" && name !== "SourceProcessor"
3247+
);
3248+
expect(published).toHaveLength(35);
3249+
let owned = 0;
3250+
for (const name of published) {
3251+
expect(surface[name]).toBeDefined();
3252+
if (name in parser) {
3253+
expect(surface[name]).toBe(parser[name]);
3254+
owned++;
3255+
}
3256+
}
3257+
expect(owned).toBe(25);
32403258
});
32413259

32423260
it("holds no printer until something prints", () => {

0 commit comments

Comments
 (0)