Improve tests.

This commit is contained in:
HarelM
2026-07-11 15:33:31 +03:00
parent b16776fed3
commit 1a5c879c75
3 changed files with 97 additions and 68 deletions
+5 -7
View File
@@ -62,11 +62,12 @@ function isLocator(target: unknown): target is Locator {
);
}
/** Asserts that every top-level key in `expected` deep-equals its counterpart in `actual`. */
/**
* Asserts that `actual` recursively contains everything in `expected`: nested
* objects are matched as subsets, while arrays and primitives must match exactly.
*/
function assertDeepNestedInclude(actual: any, expected: Record<string, unknown> | unknown[]): void {
for (const key of Object.keys(expected)) {
expect(actual?.[key], `property "${key}"`).toEqual((expected as any)[key]);
}
expect(actual).toMatchObject(expected);
}
/**
@@ -145,9 +146,6 @@ async function typeSequence(page: Page, text: string): Promise<void> {
tab: "Tab",
home: "Home",
rightarrow: "ArrowRight",
leftarrow: "ArrowLeft",
uparrow: "ArrowUp",
downarrow: "ArrowDown",
};
for (let i = 0; i < tokens.length; i++) {