Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
robertandremitchell committed Oct 22, 2024
1 parent caea3c1 commit 29dd352
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions query-connector/tests-examples/demo-todo-app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,14 +467,19 @@ async function checkNumberOfTodosInLocalStorage(page: Page, expected: number) {
}, expected);
}

interface TodoItem {
title: string;
completed: boolean;
}

async function checkNumberOfCompletedTodosInLocalStorage(
page: Page,
expected: number,
) {
return await page.waitForFunction((e) => {
return (
JSON.parse(localStorage["react-todos"]).filter(
(todo: any) => todo.completed,
(todo: TodoItem) => todo.completed,
).length === e
);
}, expected);
Expand All @@ -483,7 +488,7 @@ async function checkNumberOfCompletedTodosInLocalStorage(
async function checkTodosInLocalStorage(page: Page, title: string) {
return await page.waitForFunction((t) => {
return JSON.parse(localStorage["react-todos"])
.map((todo: any) => todo.title)
.map((todo: TodoItem) => todo.title)
.includes(t);
}, title);
}

0 comments on commit 29dd352

Please sign in to comment.