From 89ab5cc8e68a67bf5a5efac568422549432508c9 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 4 Jun 2026 19:25:41 +0200 Subject: [PATCH] test(logistics): remove obsolete single-hotel test (superseded by logistics-hotels) Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/unit/logistics-hotel.test.ts | 99 ------------------------------ 1 file changed, 99 deletions(-) delete mode 100644 tests/unit/logistics-hotel.test.ts diff --git a/tests/unit/logistics-hotel.test.ts b/tests/unit/logistics-hotel.test.ts deleted file mode 100644 index f56d04d..0000000 --- a/tests/unit/logistics-hotel.test.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { afterAll, describe, expect, it } from 'vitest' -import { prisma, createCaller } from '../setup' -import { createTestUser, createTestProgram, cleanupTestData, uid } from '../helpers' -import { logisticsRouter } from '../../src/server/routers/logistics' - -describe('logistics.getHotel + upsertHotel', () => { - const programIds: string[] = [] - const userIds: string[] = [] - - afterAll(async () => { - for (const programId of programIds) { - await prisma.hotel.deleteMany({ where: { programId } }) - await cleanupTestData(programId, []) - } - if (userIds.length > 0) { - await prisma.user.deleteMany({ where: { id: { in: userIds } } }) - } - }) - - it('getHotel returns null when no hotel set', async () => { - const admin = await createTestUser('SUPER_ADMIN') - userIds.push(admin.id) - const program = await createTestProgram({ name: `hotel-empty-${uid()}` }) - programIds.push(program.id) - const caller = createCaller(logisticsRouter, { - id: admin.id, - email: admin.email, - role: 'SUPER_ADMIN', - }) - const hotel = await caller.getHotel({ programId: program.id }) - expect(hotel).toBeNull() - }) - - it('upsertHotel creates a hotel on first call', async () => { - const admin = await createTestUser('SUPER_ADMIN') - userIds.push(admin.id) - const program = await createTestProgram({ name: `hotel-create-${uid()}` }) - programIds.push(program.id) - const caller = createCaller(logisticsRouter, { - id: admin.id, - email: admin.email, - role: 'SUPER_ADMIN', - }) - const hotel = await caller.upsertHotel({ - programId: program.id, - name: 'Hotel Hermitage', - address: 'Square Beaumarchais, 98000 Monaco', - link: 'https://hotelhermitagemontecarlo.com', - notes: 'Adjacent to the venue', - }) - expect(hotel.name).toBe('Hotel Hermitage') - expect(hotel.programId).toBe(program.id) - expect(hotel.link).toContain('hermitage') - }) - - it('upsertHotel updates the existing hotel on second call', async () => { - const admin = await createTestUser('SUPER_ADMIN') - userIds.push(admin.id) - const program = await createTestProgram({ name: `hotel-update-${uid()}` }) - programIds.push(program.id) - const caller = createCaller(logisticsRouter, { - id: admin.id, - email: admin.email, - role: 'SUPER_ADMIN', - }) - await caller.upsertHotel({ - programId: program.id, - name: 'Hotel A', - }) - const updated = await caller.upsertHotel({ - programId: program.id, - name: 'Hotel B', - notes: 'Changed our mind', - }) - expect(updated.name).toBe('Hotel B') - expect(updated.notes).toBe('Changed our mind') - // Still 1:1 — no second hotel row - const count = await prisma.hotel.count({ where: { programId: program.id } }) - expect(count).toBe(1) - }) - - it('upsertHotel normalizes empty link string to null', async () => { - const admin = await createTestUser('SUPER_ADMIN') - userIds.push(admin.id) - const program = await createTestProgram({ name: `hotel-empty-link-${uid()}` }) - programIds.push(program.id) - const caller = createCaller(logisticsRouter, { - id: admin.id, - email: admin.email, - role: 'SUPER_ADMIN', - }) - const hotel = await caller.upsertHotel({ - programId: program.id, - name: 'No-link Hotel', - link: '', - }) - expect(hotel.link).toBeNull() - }) -})