fix tests isues
This commit is contained in:
+8
-1
@@ -1,4 +1,11 @@
|
||||
DATABASE_URL=postgresql://placeholder:placeholder@placeholder:5432/placeholder
|
||||
DATABASE_URL=postgresql://postgres:password@postgres:5432/rentaldrivego
|
||||
DATABASE_URL_FROM_POSTGRES=true
|
||||
POSTGRES_HOST=postgres
|
||||
POSTGRES_HOST_LOCAL=localhost
|
||||
POSTGRES_PORT=5432
|
||||
POSTGRES_DB=rentaldrivego
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=password
|
||||
REDIS_URL=redis://redis:6379
|
||||
API_PORT=4000
|
||||
API_URL=http://localhost:4000
|
||||
|
||||
@@ -49,7 +49,7 @@ export function detectImageType(buffer: Buffer): DetectedFile | null {
|
||||
function assertSafeImageContent(file: Express.Multer.File) {
|
||||
const detected = detectImageType(file.buffer)
|
||||
if (!detected || !ALLOWED_IMAGE_TYPES.has(detected.mime)) {
|
||||
throw new ValidationError(`Unsupported or spoofed image file: ${file.name}`)
|
||||
throw new ValidationError(`Unsupported or spoofed image file: ${file.originalname}`)
|
||||
}
|
||||
|
||||
if (file.mimetype !== detected.mime) {
|
||||
|
||||
@@ -36,6 +36,6 @@ describe('upload assertions', () => {
|
||||
expect(() => assertImageFiles([
|
||||
file({ originalname: 'front.png', mimetype: 'image/png', buffer: Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]) }),
|
||||
file({ originalname: 'report.pdf', mimetype: 'application/pdf', buffer: Buffer.from('%PDF') }),
|
||||
])).toThrow(`Unsupported or spoofed image file: ${overrides.name}`)
|
||||
])).toThrow('Unsupported or spoofed image file: report.pdf')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
|
||||
> rentaldrivego@1.0.0 test:admin
|
||||
> npm run test --workspace @rentaldrivego/admin
|
||||
|
||||
|
||||
> @rentaldrivego/admin@1.0.0 test
|
||||
> vitest run
|
||||
|
||||
[33mThe CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.[39m
|
||||
|
||||
RUN v1.6.1 /Volumes/ExternalApps/Documents/car_management_system/apps/admin
|
||||
|
||||
✓ src/lib/api.test.ts (3 tests) 11ms
|
||||
❯ src/lib/appUrls.test.ts (5 tests | 1 failed) 6ms
|
||||
❯ src/lib/appUrls.test.ts > admin app URL resolution > resolves server app URLs from forwarded host and protocol
|
||||
→ expected 'https://admin.example.com:3002/admin' to be 'https://admin.example.com/admin' // Object.is equality
|
||||
✓ src/app/root-redirects.test.ts (1 test) 3ms
|
||||
✓ src/app/favicon.ico/route.test.ts (2 tests) 21ms
|
||||
✓ src/components/PublicShell.test.ts (2 tests) 3ms
|
||||
|
||||
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
|
||||
|
||||
FAIL src/lib/appUrls.test.ts > admin app URL resolution > resolves server app URLs from forwarded host and protocol
|
||||
AssertionError: expected 'https://admin.example.com:3002/admin' to be 'https://admin.example.com/admin' // Object.is equality
|
||||
|
||||
- Expected
|
||||
+ Received
|
||||
|
||||
- https://admin.example.com/admin
|
||||
+ https://admin.example.com:3002/admin
|
||||
|
||||
❯ src/lib/appUrls.test.ts:31:94
|
||||
29|
|
||||
30| it('resolves server app URLs from forwarded host and protocol', () =…
|
||||
31| expect(resolveServerAppUrl('http://localhost:3002/admin', 'admin.e…
|
||||
| ^
|
||||
32| })
|
||||
33|
|
||||
|
||||
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
|
||||
|
||||
Test Files 1 failed | 4 passed (5)
|
||||
Tests 1 failed | 12 passed (13)
|
||||
Start at 00:10:14
|
||||
Duration 226ms (transform 118ms, setup 0ms, collect 180ms, tests 44ms, environment 0ms, prepare 305ms)
|
||||
|
||||
npm error Lifecycle script `test` failed with error:
|
||||
npm error code 1
|
||||
npm error path /Volumes/ExternalApps/Documents/car_management_system/apps/admin
|
||||
npm error workspace @rentaldrivego/admin@1.0.0
|
||||
npm error location /Volumes/ExternalApps/Documents/car_management_system/apps/admin
|
||||
npm error command failed
|
||||
npm error command sh -c vitest run
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,56 +0,0 @@
|
||||
|
||||
> rentaldrivego@1.0.0 test:dashboard
|
||||
> npm run test --workspace @rentaldrivego/dashboard
|
||||
|
||||
|
||||
> @rentaldrivego/dashboard@1.0.0 test
|
||||
> vitest run
|
||||
|
||||
[33mThe CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.[39m
|
||||
|
||||
RUN v1.6.1 /Volumes/ExternalApps/Documents/car_management_system/apps/dashboard
|
||||
|
||||
✓ src/lib/preferences.test.ts (4 tests) 3ms
|
||||
✓ src/hooks/useTeam.state.test.ts (5 tests) 3ms
|
||||
✓ src/components/reservations/VehicleConditionSheet.boundary.test.ts (5 tests) 4ms
|
||||
✓ src/middleware.test.ts (7 tests) 79ms
|
||||
✓ src/components/ui/StatCard.test.ts (4 tests) 3ms
|
||||
✓ src/lib/api.test.ts (4 tests) 83ms
|
||||
✓ src/components/reservations/DamageInspectionCard.helpers.test.ts (4 tests) 4ms
|
||||
❯ src/components/VehicleCalendar.boundary.test.ts (5 tests | 1 failed) 7ms
|
||||
❯ src/components/VehicleCalendar.boundary.test.ts > VehicleCalendar helpers > builds a full week-aligned month grid with leading and trailing blanks
|
||||
→ expected 2026-03-01T05:00:00.000Z to be null
|
||||
✓ src/components/VehiclePricingManager.helpers.test.ts (7 tests) 4ms
|
||||
✓ src/lib/dashboardPaths.test.ts (3 tests) 2ms
|
||||
✓ src/lib/appUrls.test.ts (4 tests) 3ms
|
||||
✓ src/components/layout/PublicShell.test.ts (2 tests) 2ms
|
||||
✓ src/lib/urls.test.ts (4 tests) 24ms
|
||||
✓ src/components/ui/BilingualInput.test.ts (4 tests) 2ms
|
||||
✓ src/app/public-auth-pages.test.ts (3 tests) 2ms
|
||||
|
||||
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
|
||||
|
||||
FAIL src/components/VehicleCalendar.boundary.test.ts > VehicleCalendar helpers > builds a full week-aligned month grid with leading and trailing blanks
|
||||
AssertionError: expected 2026-03-01T05:00:00.000Z to be null
|
||||
❯ src/components/VehicleCalendar.boundary.test.ts:32:22
|
||||
30| const march = calendarGridDays(2026, 3)
|
||||
31| expect(march).toHaveLength(35)
|
||||
32| expect(march[0]).toBeNull()
|
||||
| ^
|
||||
33| expect(march[6]?.getDate()).toBe(7)
|
||||
34| expect(march.at(-1)).toBeNull()
|
||||
|
||||
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
|
||||
|
||||
Test Files 1 failed | 14 passed (15)
|
||||
Tests 1 failed | 64 passed (65)
|
||||
Start at 00:08:07
|
||||
Duration 754ms (transform 742ms, setup 0ms, collect 1.64s, tests 225ms, environment 1ms, prepare 1.25s)
|
||||
|
||||
npm error Lifecycle script `test` failed with error:
|
||||
npm error code 1
|
||||
npm error path /Volumes/ExternalApps/Documents/car_management_system/apps/dashboard
|
||||
npm error workspace @rentaldrivego/dashboard@1.0.0
|
||||
npm error location /Volumes/ExternalApps/Documents/car_management_system/apps/dashboard
|
||||
npm error command failed
|
||||
npm error command sh -c vitest run
|
||||
@@ -1,8 +0,0 @@
|
||||
npm error Missing script: "test:frontedns"
|
||||
npm error
|
||||
npm error Did you mean this?
|
||||
npm error npm run test:frontends # run the "test:frontends" package script
|
||||
npm error
|
||||
npm error To see a list of scripts, run:
|
||||
npm error npm run
|
||||
npm error A complete log of this run can be found in: /Users/larbi/.npm/_logs/2026-06-10T04_10_55_339Z-debug-0.log
|
||||
@@ -1,60 +0,0 @@
|
||||
|
||||
> rentaldrivego@1.0.0 test:frontends
|
||||
> npm run test:dashboard && npm run test:admin && npm run test:marketplace
|
||||
|
||||
|
||||
> rentaldrivego@1.0.0 test:dashboard
|
||||
> npm run test --workspace @rentaldrivego/dashboard
|
||||
|
||||
|
||||
> @rentaldrivego/dashboard@1.0.0 test
|
||||
> vitest run
|
||||
|
||||
[33mThe CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.[39m
|
||||
|
||||
RUN v1.6.1 /Volumes/ExternalApps/Documents/car_management_system/apps/dashboard
|
||||
|
||||
✓ src/lib/preferences.test.ts (4 tests) 3ms
|
||||
✓ src/hooks/useTeam.state.test.ts (5 tests) 3ms
|
||||
✓ src/middleware.test.ts (7 tests) 78ms
|
||||
✓ src/components/reservations/VehicleConditionSheet.boundary.test.ts (5 tests) 2ms
|
||||
✓ src/components/ui/StatCard.test.ts (4 tests) 4ms
|
||||
✓ src/lib/api.test.ts (4 tests) 77ms
|
||||
✓ src/components/reservations/DamageInspectionCard.helpers.test.ts (4 tests) 3ms
|
||||
✓ src/components/VehiclePricingManager.helpers.test.ts (7 tests) 3ms
|
||||
❯ src/components/VehicleCalendar.boundary.test.ts (5 tests | 1 failed) 11ms
|
||||
❯ src/components/VehicleCalendar.boundary.test.ts > VehicleCalendar helpers > builds a full week-aligned month grid with leading and trailing blanks
|
||||
→ expected 2026-03-01T05:00:00.000Z to be null
|
||||
✓ src/lib/dashboardPaths.test.ts (3 tests) 1ms
|
||||
✓ src/lib/urls.test.ts (4 tests) 38ms
|
||||
✓ src/lib/appUrls.test.ts (4 tests) 2ms
|
||||
✓ src/components/ui/BilingualInput.test.ts (4 tests) 2ms
|
||||
✓ src/components/layout/PublicShell.test.ts (2 tests) 4ms
|
||||
✓ src/app/public-auth-pages.test.ts (3 tests) 2ms
|
||||
|
||||
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
|
||||
|
||||
FAIL src/components/VehicleCalendar.boundary.test.ts > VehicleCalendar helpers > builds a full week-aligned month grid with leading and trailing blanks
|
||||
AssertionError: expected 2026-03-01T05:00:00.000Z to be null
|
||||
❯ src/components/VehicleCalendar.boundary.test.ts:32:22
|
||||
30| const march = calendarGridDays(2026, 3)
|
||||
31| expect(march).toHaveLength(35)
|
||||
32| expect(march[0]).toBeNull()
|
||||
| ^
|
||||
33| expect(march[6]?.getDate()).toBe(7)
|
||||
34| expect(march.at(-1)).toBeNull()
|
||||
|
||||
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
|
||||
|
||||
Test Files 1 failed | 14 passed (15)
|
||||
Tests 1 failed | 64 passed (65)
|
||||
Start at 00:11:10
|
||||
Duration 760ms (transform 501ms, setup 0ms, collect 1.41s, tests 233ms, environment 9ms, prepare 1.45s)
|
||||
|
||||
npm error Lifecycle script `test` failed with error:
|
||||
npm error code 1
|
||||
npm error path /Volumes/ExternalApps/Documents/car_management_system/apps/dashboard
|
||||
npm error workspace @rentaldrivego/dashboard@1.0.0
|
||||
npm error location /Volumes/ExternalApps/Documents/car_management_system/apps/dashboard
|
||||
npm error command failed
|
||||
npm error command sh -c vitest run
|
||||
@@ -1,84 +0,0 @@
|
||||
|
||||
> rentaldrivego@1.0.0 test:marketplace
|
||||
> npm run test --workspace @rentaldrivego/marketplace
|
||||
|
||||
|
||||
> @rentaldrivego/marketplace@1.0.0 test
|
||||
> vitest run
|
||||
|
||||
[33mThe CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.[39m
|
||||
|
||||
RUN v1.6.1 /Volumes/ExternalApps/Documents/car_management_system/apps/marketplace
|
||||
|
||||
✓ src/lib/api.test.ts (5 tests) 6ms
|
||||
❯ src/lib/appUrls.test.ts (5 tests | 1 failed) 6ms
|
||||
❯ src/lib/appUrls.test.ts > marketplace app URL resolution > resolves server URLs from forwarded host/proto and handles invalid fallbacks safely
|
||||
→ expected 'https://market.example.com:3000' to be 'https://market.example.com' // Object.is equality
|
||||
✓ src/lib/renter.test.ts (4 tests) 29ms
|
||||
✓ src/lib/preferences.test.ts (3 tests) 2ms
|
||||
✓ src/middleware.test.ts (5 tests) 40ms
|
||||
✓ src/lib/footerContent.test.ts (4 tests) 8ms
|
||||
✓ src/components/FooterContentPage.test.ts (4 tests) 6ms
|
||||
✓ src/components/MarketplaceShell.content.test.ts (4 tests) 3ms
|
||||
❯ src/components/WorkspaceFrame.boundary.test.ts (5 tests | 1 failed) 7ms
|
||||
❯ src/components/WorkspaceFrame.boundary.test.ts > WorkspaceFrame helpers > sends users with an employee token directly to the dashboard frame path
|
||||
→ expected '/dashboard/sign-in' to be '/dashboard' // Object.is equality
|
||||
✓ src/lib/i18n.server.test.ts (3 tests) 2ms
|
||||
✓ src/lib/i18n.test.ts (2 tests) 3ms
|
||||
✓ src/components/BookingForm.boundary.test.ts (5 tests) 2ms
|
||||
✓ src/app/(public)/footer/[slug]/page.test.ts (3 tests) 4ms
|
||||
✓ src/app/(public)/app-policy-pages.test.ts (2 tests) 3ms
|
||||
✓ src/components/MarketplaceHeader.boundary.test.ts (4 tests) 2ms
|
||||
|
||||
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 2 ⎯⎯⎯⎯⎯⎯⎯
|
||||
|
||||
FAIL src/components/WorkspaceFrame.boundary.test.ts > WorkspaceFrame helpers > sends users with an employee token directly to the dashboard frame path
|
||||
AssertionError: expected '/dashboard/sign-in' to be '/dashboard' // Object.is equality
|
||||
|
||||
- Expected
|
||||
+ Received
|
||||
|
||||
- /dashboard
|
||||
+ /dashboard/sign-in
|
||||
|
||||
❯ src/components/WorkspaceFrame.boundary.test.ts:28:44
|
||||
26| stubBrowser({ cookie: 'other=1; employee_session=token_123' })
|
||||
27|
|
||||
28| expect(getDefaultFramePath('sign-in')).toBe('/dashboard')
|
||||
| ^
|
||||
29| })
|
||||
30|
|
||||
|
||||
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/2]⎯
|
||||
|
||||
FAIL src/lib/appUrls.test.ts > marketplace app URL resolution > resolves server URLs from forwarded host/proto and handles invalid fallbacks safely
|
||||
AssertionError: expected 'https://market.example.com:3000' to be 'https://market.example.com' // Object.is equality
|
||||
|
||||
- Expected
|
||||
+ Received
|
||||
|
||||
- https://market.example.com
|
||||
+ https://market.example.com:3000
|
||||
|
||||
❯ src/lib/appUrls.test.ts:36:89
|
||||
34|
|
||||
35| it('resolves server URLs from forwarded host/proto and handles inval…
|
||||
36| expect(resolveServerAppUrl('http://localhost:3000', 'market.exampl…
|
||||
| ^
|
||||
37| expect(resolveServerAppUrl('http://localhost:3000', null)).toBe('h…
|
||||
38| expect(resolveServerAppUrl('/relative', 'market.example.com')).toB…
|
||||
|
||||
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/2]⎯
|
||||
|
||||
Test Files 2 failed | 13 passed (15)
|
||||
Tests 2 failed | 56 passed (58)
|
||||
Start at 00:09:12
|
||||
Duration 619ms (transform 491ms, setup 3ms, collect 1.20s, tests 123ms, environment 2ms, prepare 1.10s)
|
||||
|
||||
npm error Lifecycle script `test` failed with error:
|
||||
npm error code 1
|
||||
npm error path /Volumes/ExternalApps/Documents/car_management_system/apps/marketplace
|
||||
npm error workspace @rentaldrivego/marketplace@1.0.0
|
||||
npm error location /Volumes/ExternalApps/Documents/car_management_system/apps/marketplace
|
||||
npm error command failed
|
||||
npm error command sh -c vitest run
|
||||
Reference in New Issue
Block a user