From 4451354eee2d47650d49cce5f436bffdfaeb55eb Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sat, 7 Jan 2023 07:46:11 -0800 Subject: [PATCH] feat(jsdoc-test-matchers): improve HTML matcher --- packages/jsdoc-test-matchers/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/jsdoc-test-matchers/index.js b/packages/jsdoc-test-matchers/index.js index 1daf7518..c430fbce 100644 --- a/packages/jsdoc-test-matchers/index.js +++ b/packages/jsdoc-test-matchers/index.js @@ -34,6 +34,12 @@ addMatchers({ return valueName === otherName; }, + toContainHtml(other, value) { + const otherDiffable = diffableHtml(other); + const valueDiffable = diffableHtml(value); + + return valueDiffable.includes(otherDiffable); + }, toHaveOwnProperty(other, value) { return Object.hasOwn(value, other); }, @@ -63,12 +69,6 @@ addMatchers({ return isMatch; }, - toMatchHtml(other, value) { - const otherDiffable = diffableHtml(other); - const valueDiffable = diffableHtml(value); - - return otherDiffable.includes(valueDiffable); - }, // The `value` object must have all of the keys and values from the `other` object. The `value` // object can have additional properties as well. For example, if `other` is `{ a: 1 }`, and // `value` is `{ a: 1, b: 2 }`, then the objects match.