(node: Nullable<N>, expectation: RegExp | string)
| 92 | }; |
| 93 | |
| 94 | export const assertNodeContent = <N extends Text | ChildNode>(node: Nullable<N>, expectation: RegExp | string): N => { |
| 95 | if (isTextNodeContaining(node, expectation)) { |
| 96 | return node!; |
| 97 | } |
| 98 | |
| 99 | console.warn('Expected node:', node!.parentElement); |
| 100 | const content = node!.textContent.trim(); |
| 101 | throw new Error(`Expected node matching ${escapeMatcher(expectation)}, found ${escapeMatcher(content)}`); |
| 102 | }; |
| 103 | |
| 104 | export const removeTextNodeContaining = (node: Text | ChildNode, expectation: RegExp | string): void => { |
| 105 | assertNodeContent(node, expectation); |
no test coverage detected