test: add full test coverage for notes, ues, ue-modules, ajustements, enseignements, users
- Unit tests (mock DB + API) for all missing endpoints - Integration tests (Drizzle direct) for all missing entities - E2E tests (handler + real DB) for all missing endpoints - Robustness tests: invalid inputs, SQL injection, type errors, business rule violations - Seed helpers: seedNotes, seedUeModules, seedEnseignements, seedAjustements - Add test:coverage and test:coverage:html tasks to deno.json Tests expose known handler bugs (marked [BUG] in test names): - ajustements PUT/DELETE: .where() without and() modifies all rows for student - Missing try/catch in modules, users, enseignements handlers - Whitespace accepted as valid string values - No type or business rule validation (note bounds, coeff >= 0)
This commit is contained in:
@@ -87,3 +87,27 @@ export async function seedUsers(
|
||||
): Promise<typeof schema.users.$inferSelect[]> {
|
||||
return await testDb.insert(schema.users).values(rows).returning();
|
||||
}
|
||||
|
||||
export async function seedNotes(
|
||||
rows: { numEtud: number; idModule: string; note: number }[],
|
||||
): Promise<typeof schema.notes.$inferSelect[]> {
|
||||
return await testDb.insert(schema.notes).values(rows).returning();
|
||||
}
|
||||
|
||||
export async function seedUeModules(
|
||||
rows: { idModule: string; idUE: number; idPromo: string; coeff: number }[],
|
||||
): Promise<typeof schema.ueModules.$inferSelect[]> {
|
||||
return await testDb.insert(schema.ueModules).values(rows).returning();
|
||||
}
|
||||
|
||||
export async function seedEnseignements(
|
||||
rows: { idProf: string; idModule: string; idPromo: string }[],
|
||||
): Promise<typeof schema.enseignements.$inferSelect[]> {
|
||||
return await testDb.insert(schema.enseignements).values(rows).returning();
|
||||
}
|
||||
|
||||
export async function seedAjustements(
|
||||
rows: { numEtud: number; idUE: number; valeur: number }[],
|
||||
): Promise<typeof schema.ajustements.$inferSelect[]> {
|
||||
return await testDb.insert(schema.ajustements).values(rows).returning();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user