Skip to content

Commit 6526b51

Browse files
use beforeEach
1 parent 63b2e94 commit 6526b51

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

demos/react-supabase-todolist-tanstackdb/e2e/todo-lists.test.tsx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ describe('TodoLists E2E', () => {
1616
let root: Root | null = null;
1717
let container: HTMLElement;
1818

19-
beforeEach(() => {
19+
beforeEach(async () => {
2020
// Set up DOM
2121
container = setupTestDOM();
22+
await renderAppAndWaitForTodoListsScreen();
2223
});
2324

2425
afterEach(async () => {
@@ -108,15 +109,11 @@ describe('TodoLists E2E', () => {
108109
}
109110

110111
it('should load the app and show the Todo Lists screen', async () => {
111-
await renderAppAndWaitForTodoListsScreen();
112-
113112
// Verify we're on the Todo Lists page
114113
expect(screen.getByText('Todo Lists')).toBeTruthy();
115114
});
116115

117116
it('should display a list widget after inserting a list via PowerSync SQL', async () => {
118-
await renderAppAndWaitForTodoListsScreen();
119-
120117
const listName = 'My Shopping List';
121118
await insertList(listName);
122119

@@ -134,8 +131,6 @@ describe('TodoLists E2E', () => {
134131
});
135132

136133
it('should display multiple list widgets after inserting multiple lists', async () => {
137-
await renderAppAndWaitForTodoListsScreen();
138-
139134
// Insert multiple lists
140135
await insertList('Groceries');
141136
await insertList('Work Tasks');
@@ -157,8 +152,6 @@ describe('TodoLists E2E', () => {
157152
});
158153

159154
it('should display list with correct todo counts (pending and completed)', async () => {
160-
await renderAppAndWaitForTodoListsScreen();
161-
162155
const listName = 'My Task List';
163156
const listId = await insertList(listName);
164157

@@ -180,8 +173,6 @@ describe('TodoLists E2E', () => {
180173
});
181174

182175
it('should render list widgets with delete and navigate action buttons', async () => {
183-
await renderAppAndWaitForTodoListsScreen();
184-
185176
const listName = 'Test List';
186177
await insertList(listName);
187178

@@ -197,8 +188,6 @@ describe('TodoLists E2E', () => {
197188
});
198189

199190
it('should display the floating action button to add new lists', async () => {
200-
await renderAppAndWaitForTodoListsScreen();
201-
202191
// The FAB should be present - find by class
203192
const fab = document.querySelector('.MuiFab-root');
204193
expect(fab).not.toBeNull();

0 commit comments

Comments
 (0)