Skip to content

Commit 8e4522e

Browse files
test: fix tests
1 parent f19cdaf commit 8e4522e

File tree

4 files changed

+42
-20
lines changed

4 files changed

+42
-20
lines changed

packages/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"@faker-js/faker": "^10.1.0",
8181
"@iconify-json/flagpack": "^1.2.6",
8282
"@iconify-json/mdi": "^1.2.3",
83-
"@playwright/test": "1.57.0",
83+
"@playwright/test": "1.58.2",
8484
"@types/bcryptjs": "^3.0.0",
8585
"@types/oidc-provider": "^9.5.0",
8686
"@types/pg": "^8.15.6",

packages/api/src/kysely/seeds/test.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {
88
SERVICE_TYPE
99
} from '../types.js'
1010

11+
const CURRENT_YEAR = new Date().getFullYear()
12+
1113
const seed = async () => {
1214
const accounts = [1, 2, 3, 4, 5].map((nr) => ({
1315
email: `test${nr}@petboarding.app`
@@ -49,11 +51,22 @@ const seed = async () => {
4951
endTimeId: 1,
5052
customerId: nr
5153
}))
54+
bookings.push({
55+
startDate: `${CURRENT_YEAR}-01-01`,
56+
endDate: `${CURRENT_YEAR}-01-11`,
57+
startTimeId: 1,
58+
endTimeId: 1,
59+
customerId: 5
60+
})
5261

5362
const bookingPet = [1, 2, 3, 4, 5].map((nr) => ({
5463
bookingId: nr,
5564
petId: nr
5665
}))
66+
bookingPet.push({
67+
bookingId: 6,
68+
petId: 5
69+
})
5770

5871
const bookingStatuseEnum = [
5972
BOOKING_STATUS.PENDING,
@@ -74,10 +87,18 @@ const seed = async () => {
7487
...bookings[nr - 1],
7588
bookingId: nr,
7689
status: bookingStatuseEnum[nr - 1],
77-
petIds: `[${nr}]`,
90+
petIds: `[${nr - 1}]`,
7891
modifiedAt: new Date().toISOString(),
7992
customerId: undefined
8093
}))
94+
bookingStatuses.push({
95+
...bookings[5],
96+
bookingId: 6,
97+
status: bookingStatuseEnum[0],
98+
petIds: `[${5}]`,
99+
modifiedAt: new Date().toISOString(),
100+
customerId: undefined
101+
})
81102

82103
const daycareDates = [1, 2, 3, 4, 5].map((nr) => ({
83104
date: `2024-02-0${nr}`,

packages/api/tests/e2e/administrator/administrator.spec.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { initializeAndLogin } from '../setup'
44

55
// import { format } from 'date-fns'
66
const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
7+
const CURRENT_YEAR = new Date().getFullYear()
78

89
const email = 'admin@petboarding.app'
910
const password = 'qjiNWdT8L'
@@ -41,15 +42,15 @@ test.describe('Bookings', async () => {
4142
await page.goto('admin/bookings')
4243
await page.waitForLoadState('networkidle')
4344

44-
await expect(page.getByText('name1 lastName1')).toBeVisible()
45+
await expect(page.getByText('name5 lastName5')).toBeVisible()
4546
})
4647
})
4748
test.describe('Occupancy', async () => {
4849
test('Check booking occupancy', async () => {
49-
await page.goto('admin/occupancy/2024-01-01')
50+
await page.goto(`admin/occupancy/2024-01-01`)
5051
await page.waitForLoadState('networkidle')
5152

52-
await page.getByText('2024/01/01').isVisible()
53+
await page.getByText(`2024/01/01`).isVisible()
5354
await expect(
5455
page
5556
.locator('div:nth-child(2) > .q-calendar-month__day--content > .column')
@@ -58,10 +59,10 @@ test.describe('Occupancy', async () => {
5859
})
5960

6061
test('Check daycare occupancy', async () => {
61-
await page.goto('admin/occupancy/2024-02-01')
62+
await page.goto(`admin/occupancy/2024-02-01`)
6263
await page.waitForLoadState('networkidle')
6364

64-
await page.getByText('2024/02/01').isVisible()
65+
await page.getByText(`2024/02/01`).isVisible()
6566
await expect(
6667
page
6768
.locator('div:nth-child(5) > .q-calendar-month__day--content > .column')

pnpm-lock.yaml

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)