style: fix deno fmt and lint

This commit is contained in:
2026-04-26 14:18:55 +02:00
committed by djalim
parent 222c3237f0
commit b3eb1b60a5
4 changed files with 69 additions and 3 deletions
+27
View File
@@ -0,0 +1,27 @@
name: "Build and push image"
on:
push:
branches:
- main
jobs:
deploy:
name: "Build Docker image"
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: registry.docker.polytech.djalim.fr
username: ${{ secrets.registry_login }}
password: ${{ secrets.registry_pass }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: registry.docker.polytech.djalim.fr/polympr:latest
+29
View File
@@ -0,0 +1,29 @@
name: "Check Deno code"
on:
pull_request:
branches:
- main
permissions:
contents: read
jobs:
check-code:
name: "Check Deno code"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Check formatting
run: deno fmt --check
- name: Check linting
run: deno lint
- name: Run tests
run: deno test -A --no-check tests/
+4 -1
View File
@@ -57,7 +57,10 @@ Deno.test({
async fn() { async fn() {
await truncateAll(); await truncateAll();
const res = await promotionsHandler.POST!( const res = await promotionsHandler.POST!(
makeJsonRequest("/promotions", "POST", { idPromo: "INFO3-2025", annee: "2025" }), makeJsonRequest("/promotions", "POST", {
idPromo: "INFO3-2025",
annee: "2025",
}),
makeEmployeeContext(), makeEmployeeContext(),
); );
assertEquals(res.status, 201); assertEquals(res.status, 201);
+9 -2
View File
@@ -41,7 +41,12 @@ Deno.test("mock API: GET /promotions/:id returns one", async () => {
}); });
Deno.test("mock API: GET /promotions/:id 404 when not found", async () => { Deno.test("mock API: GET /promotions/:id 404 when not found", async () => {
mockFetch({ "/promotions/UNKNOWN": { status: 404, body: { error: "Ressource introuvable" } } }); mockFetch({
"/promotions/UNKNOWN": {
status: 404,
body: { error: "Ressource introuvable" },
},
});
try { try {
const res = await fetch("http://localhost/api/promotions/UNKNOWN"); const res = await fetch("http://localhost/api/promotions/UNKNOWN");
assertEquals(res.status, 404); assertEquals(res.status, 404);
@@ -83,7 +88,9 @@ Deno.test("mock API: POST /promotions 400 on missing fields", async () => {
Deno.test("mock API: PUT /promotions/:id updates promotion", async () => { Deno.test("mock API: PUT /promotions/:id updates promotion", async () => {
const updated = { idPromo: "4AFISE25/26", annee: "2026" }; const updated = { idPromo: "4AFISE25/26", annee: "2026" };
mockFetch({ "/promotions/4AFISE25%2F26": { method: "PUT", status: 200, body: updated } }); mockFetch({
"/promotions/4AFISE25%2F26": { method: "PUT", status: 200, body: updated },
});
try { try {
const res = await fetch("http://localhost/api/promotions/4AFISE25%2F26", { const res = await fetch("http://localhost/api/promotions/4AFISE25%2F26", {
method: "PUT", method: "PUT",