refactor: simplify array initialization in child sort order tests
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m30s

This commit is contained in:
2026-03-26 12:51:29 -04:00
parent 028f99b5c3
commit 469a2ffc24
2 changed files with 8 additions and 22 deletions

View File

@@ -135,10 +135,9 @@ test.describe('Notification click navigates and scrolls to task', () => {
await notifItem.click() await notifItem.click()
// Verify navigation to parent child view with scrollTo query param // Verify navigation to parent child view with scrollTo query param
await page.waitForURL( await page.waitForURL(new RegExp(`/parent/${childId}\\?scrollTo=.*&entityType=chore`), {
new RegExp(`/parent/${childId}\\?scrollTo=.*&entityType=chore`), timeout: 5000,
{ timeout: 5000 }, })
)
// Verify the target chore card is scrolled into viewport // Verify the target chore card is scrolled into viewport
const targetCard = choreSection(page).locator('.item-card').filter({ hasText: targetChoreName }) const targetCard = choreSection(page).locator('.item-card').filter({ hasText: targetChoreName })
@@ -156,10 +155,9 @@ test.describe('Notification click navigates and scrolls to task', () => {
await notifItem.click() await notifItem.click()
await page.waitForURL( await page.waitForURL(new RegExp(`/parent/${childId}\\?scrollTo=.*&entityType=reward`), {
new RegExp(`/parent/${childId}\\?scrollTo=.*&entityType=reward`), timeout: 5000,
{ timeout: 5000 }, })
)
const targetCard = rewardSection(page).locator('.item-card').filter({ hasText: REWARD_NAME }) const targetCard = rewardSection(page).locator('.item-card').filter({ hasText: REWARD_NAME })
await expect(targetCard).toBeVisible({ timeout: 5000 }) await expect(targetCard).toBeVisible({ timeout: 5000 })

View File

@@ -109,13 +109,7 @@ test.describe('Child mode sort order', () => {
cheapRewardId = await createReward(request, CHEAP_REWARD, 15) cheapRewardId = await createReward(request, CHEAP_REWARD, 15)
expensiveRewardId = await createReward(request, EXPENSIVE_REWARD, 100) expensiveRewardId = await createReward(request, EXPENSIVE_REWARD, 100)
const allChoreIds = [ const allChoreIds = [schedEarlyId, schedLateId, generalChoreId, pendingChoreId, nonTodayChoreId]
schedEarlyId,
schedLateId,
generalChoreId,
pendingChoreId,
nonTodayChoreId,
]
await request.put(`/api/child/${childId}/set-tasks`, { await request.put(`/api/child/${childId}/set-tasks`, {
data: { task_ids: allChoreIds, type: 'chore' }, data: { task_ids: allChoreIds, type: 'chore' },
}) })
@@ -174,13 +168,7 @@ test.describe('Child mode sort order', () => {
test.afterAll(async ({ request }) => { test.afterAll(async ({ request }) => {
if (childId) await request.delete(`/api/child/${childId}`) if (childId) await request.delete(`/api/child/${childId}`)
for (const id of [ for (const id of [schedEarlyId, schedLateId, generalChoreId, pendingChoreId, nonTodayChoreId]) {
schedEarlyId,
schedLateId,
generalChoreId,
pendingChoreId,
nonTodayChoreId,
]) {
if (id) await request.delete(`/api/task/${id}`) if (id) await request.delete(`/api/task/${id}`)
} }
for (const id of [pendingRewardId, cheapRewardId, expensiveRewardId]) { for (const id of [pendingRewardId, cheapRewardId, expensiveRewardId]) {