mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
- Add await to unawaited bookingSeatsRepositoryFixture.create calls - Clean up leftover selected slots before seated and variable length tests - Add deleteAllByUserId method to SelectedSlotRepositoryFixture The flakiness was caused by reserved slots from earlier tests leaking into subsequent test groups. The availability calculation fetches all unexpired reserved slots by userId (not eventTypeId), so non-seat reserved slots from regular event type tests appeared as busy times when computing slots for seated and variable length event types. Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Anik Dhabal Babu <[email protected]>
27 lines
982 B
TypeScript
27 lines
982 B
TypeScript
import type { SelectedSlots } from "@calcom/prisma/client";
|
|
import { TestingModule } from "@nestjs/testing";
|
|
import { PrismaReadService } from "@/modules/prisma/prisma-read.service";
|
|
import { PrismaWriteService } from "@/modules/prisma/prisma-write.service";
|
|
|
|
export class SelectedSlotRepositoryFixture {
|
|
private prismaReadClient: PrismaReadService["prisma"];
|
|
private prismaWriteClient: PrismaWriteService["prisma"];
|
|
|
|
constructor(module: TestingModule) {
|
|
this.prismaReadClient = module.get(PrismaReadService).prisma;
|
|
this.prismaWriteClient = module.get(PrismaWriteService).prisma;
|
|
}
|
|
|
|
async getByUid(uid: string) {
|
|
return this.prismaReadClient.selectedSlots.findFirst({ where: { uid } });
|
|
}
|
|
|
|
async deleteByUId(uid: SelectedSlots["uid"]) {
|
|
return this.prismaWriteClient.selectedSlots.deleteMany({ where: { uid } });
|
|
}
|
|
|
|
async deleteAllByUserId(userId: number) {
|
|
return this.prismaWriteClient.selectedSlots.deleteMany({ where: { userId } });
|
|
}
|
|
}
|