chore: formated tests
Check Deno code / Check Deno code (pull_request) Successful in 5s
Tests / Unit tests (pull_request) Successful in 12s
Tests / Integration tests (pull_request) Successful in 1m9s
Check Deno code / Check Deno code (push) Successful in 6s
Tests / Unit tests (push) Successful in 12s
Tests / Integration tests (push) Successful in 1m13s
Check Deno code / Check Deno code (pull_request) Successful in 5s
Tests / Unit tests (pull_request) Successful in 12s
Tests / Integration tests (pull_request) Successful in 1m9s
Check Deno code / Check Deno code (push) Successful in 6s
Tests / Unit tests (push) Successful in 12s
Tests / Integration tests (push) Successful in 1m13s
This commit was merged in pull request #145.
This commit is contained in:
@@ -17,7 +17,11 @@ Deno.test({
|
||||
async fn() {
|
||||
await truncateAll();
|
||||
await seedPromotions([{ id: "PROMO-2024" }]);
|
||||
const [s] = await seedStudents([{ nom: "Dupont", prenom: "Jean", idPromo: "PROMO-2024" }]);
|
||||
const [s] = await seedStudents([{
|
||||
nom: "Dupont",
|
||||
prenom: "Jean",
|
||||
idPromo: "PROMO-2024",
|
||||
}]);
|
||||
await seedModules([{ id: "MOD101", nom: "Module A" }]);
|
||||
await seedNotes([{ numEtud: s.numEtud, idModule: "MOD101", note: 15.5 }]);
|
||||
const rows = await testDb.select().from(notes);
|
||||
@@ -32,10 +36,18 @@ Deno.test({
|
||||
async fn() {
|
||||
await truncateAll();
|
||||
await seedPromotions([{ id: "PROMO-2024" }]);
|
||||
const [s] = await seedStudents([{ nom: "Martin", prenom: "Alice", idPromo: "PROMO-2024" }]);
|
||||
const [s] = await seedStudents([{
|
||||
nom: "Martin",
|
||||
prenom: "Alice",
|
||||
idPromo: "PROMO-2024",
|
||||
}]);
|
||||
await seedModules([{ id: "MOD102", nom: "Module B" }]);
|
||||
|
||||
const [created] = await testDb.insert(notes).values({ numEtud: s.numEtud, idModule: "MOD102", note: 12.0 }).returning();
|
||||
const [created] = await testDb.insert(notes).values({
|
||||
numEtud: s.numEtud,
|
||||
idModule: "MOD102",
|
||||
note: 12.0,
|
||||
}).returning();
|
||||
assertExists(created);
|
||||
assertEquals(created.note, 12.0);
|
||||
|
||||
@@ -71,11 +83,19 @@ Deno.test({
|
||||
async fn() {
|
||||
await truncateAll();
|
||||
await seedPromotions([{ id: "PROMO-2024" }]);
|
||||
const [s] = await seedStudents([{ nom: "Durand", prenom: "Claire", idPromo: "PROMO-2024" }]);
|
||||
const [s] = await seedStudents([{
|
||||
nom: "Durand",
|
||||
prenom: "Claire",
|
||||
idPromo: "PROMO-2024",
|
||||
}]);
|
||||
await seedModules([{ id: "MOD103", nom: "Module C" }]);
|
||||
await seedNotes([{ numEtud: s.numEtud, idModule: "MOD103", note: 10.0 }]);
|
||||
await assertRejects(() =>
|
||||
testDb.insert(notes).values({ numEtud: s.numEtud, idModule: "MOD103", note: 11.0 })
|
||||
testDb.insert(notes).values({
|
||||
numEtud: s.numEtud,
|
||||
idModule: "MOD103",
|
||||
note: 11.0,
|
||||
})
|
||||
);
|
||||
},
|
||||
sanitizeResources: false,
|
||||
@@ -87,7 +107,11 @@ Deno.test({
|
||||
async fn() {
|
||||
await truncateAll();
|
||||
await seedPromotions([{ id: "PROMO-2024" }]);
|
||||
const [s] = await seedStudents([{ nom: "Bernard", prenom: "Lucie", idPromo: "PROMO-2024" }]);
|
||||
const [s] = await seedStudents([{
|
||||
nom: "Bernard",
|
||||
prenom: "Lucie",
|
||||
idPromo: "PROMO-2024",
|
||||
}]);
|
||||
await seedModules([{ id: "MOD104", nom: "Module D" }]);
|
||||
await seedNotes([{ numEtud: s.numEtud, idModule: "MOD104", note: 8.0 }]);
|
||||
|
||||
@@ -107,11 +131,17 @@ Deno.test({
|
||||
async fn() {
|
||||
await truncateAll();
|
||||
await seedPromotions([{ id: "PROMO-2024" }]);
|
||||
const [s] = await seedStudents([{ nom: "Thomas", prenom: "Eva", idPromo: "PROMO-2024" }]);
|
||||
const [s] = await seedStudents([{
|
||||
nom: "Thomas",
|
||||
prenom: "Eva",
|
||||
idPromo: "PROMO-2024",
|
||||
}]);
|
||||
await seedModules([{ id: "MOD105", nom: "Module E" }]);
|
||||
await seedNotes([{ numEtud: s.numEtud, idModule: "MOD105", note: 14.0 }]);
|
||||
|
||||
await testDb.delete(notes).where(and(eq(notes.numEtud, s.numEtud), eq(notes.idModule, "MOD105")));
|
||||
await testDb.delete(notes).where(
|
||||
and(eq(notes.numEtud, s.numEtud), eq(notes.idModule, "MOD105")),
|
||||
);
|
||||
const row = await testDb
|
||||
.select()
|
||||
.from(notes)
|
||||
|
||||
Reference in New Issue
Block a user