mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
test: compare DOM nodes by identity, never through assert.equal
A failed assert.equal or deepEqual prints both operands, and a happy-dom node reaches the whole page and window: printing one exhausted memory and took the machine down. assertSameNode() compares identity and fails with a short description of each node; every node comparison in the happy-dom tests uses it.
This commit is contained in:
1 parent
e949584c0a
commit
3a2acf9b0f
8 files changed
+46
-20
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { after, before, test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { assertSameNode } from '../testSupport/domAssert.mjs';
|
||||
import { installVueDom } from '../testSupport/vueDom.mjs';
|
||||
|
||||
let PanelNavigation;
|
||||
@@ -132,8 +133,8 @@ test('destroy removes the rails and stops following the stacks', async () => {
|
||||
const { left, right, calls, ui, navigation } = setup();
|
||||
navigation.destroy();
|
||||
navigation.destroy();
|
||||
assert.equal(left.querySelector('.gev-panel-rail'), null);
|
||||
assert.equal(right.querySelector('.gev-panel-rail'), null);
|
||||
assertSameNode(left.querySelector('.gev-panel-rail'), null);
|
||||
assertSameNode(right.querySelector('.gev-panel-rail'), null);
|
||||
navigation.select('data-panel');
|
||||
assert.deepEqual(calls, []);
|
||||
ui.destroy();
|
||||
|
||||
Reference in new issue
Block a user