Release / release-apk (push) Successful in 8m58s
Release / release-docker (push) Successful in 3m47s
CI / docker (push) Successful in 7s
CI / lint-backend (push) Successful in 1m44s
CI / lint-mobile (push) Failing after 18m59s
CI / test-backend (push) Successful in 2m12s
CI / test-mobile (push) Successful in 8m50s
CI / build-backend (push) Successful in 45s
Backend : resource_previews (000024), GET /files/:id/preview (JPEG
512, images pur Go, PDF page 1 via pdftoppm + poppler au Dockerfile,
cache régénéré sur changement, 404 NO_PREVIEW sinon), POST /export
{password 8+} -> zip AES-256 streamé (fichiers vifs possédés +
manifest.json avec faits, metadata-only sans octets). Deps :
alexmullins/zip, x/image directs. Tests service + handlers + migrations.
Mobile : vignettes distantes (une requête/session puis cache WebP
versionné, garde tried, icône sinon), FileThumbnail cloud-only,
export (mot de passe jamais persisté, cache + partage FileProvider),
bouton Partager ACTION_SEND. Impression papier reportée V4. FR/EN.
Contrat docs/api-v1.md, V3.md (S7 livré, V3 close), AGENTS.md,
VERSION 1.2.0 + CHANGELOG.
91 lines
2.6 KiB
Go
91 lines
2.6 KiB
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
// expectedRoutes mirrors the endpoints in mobile/api/client.ts (the contract).
|
|
// Paths are full (under /api/v1), methods match the client calls exactly.
|
|
var expectedRoutes = []string{
|
|
"GET /api/v1/health",
|
|
"POST /api/v1/devices",
|
|
"POST /api/v1/auth/login",
|
|
"GET /api/v1/shares/links/:token",
|
|
|
|
"GET /api/v1/files",
|
|
"GET /api/v1/files/search",
|
|
"GET /api/v1/files/folders",
|
|
"GET /api/v1/files/:id",
|
|
"GET /api/v1/files/:id/ocr",
|
|
"GET /api/v1/files/:id/facts",
|
|
"PATCH /api/v1/files/:id/facts",
|
|
"GET /api/v1/files/:id/content",
|
|
"GET /api/v1/files/:id/preview",
|
|
"GET /api/v1/files/:id/shares",
|
|
"GET /api/v1/files/:id/links",
|
|
"GET /api/v1/files/:id/placements",
|
|
"GET /api/v1/files/:id/versions",
|
|
"GET /api/v1/files/:id/relations",
|
|
"POST /api/v1/files/:id/relations/verdict",
|
|
"GET /api/v1/duplicates",
|
|
"POST /api/v1/export",
|
|
"POST /api/v1/files/:id/restore",
|
|
"POST /api/v1/files/:id/versions/:n/restore",
|
|
"GET /api/v1/trash",
|
|
"DELETE /api/v1/files/:id",
|
|
"POST /api/v1/files/upload",
|
|
|
|
"GET /api/v1/users/resolve",
|
|
"PATCH /api/v1/users/me/password",
|
|
"GET /api/v1/users/me/usage",
|
|
|
|
"GET /api/v1/devices",
|
|
"DELETE /api/v1/devices/:id",
|
|
|
|
"POST /api/v1/groups",
|
|
"GET /api/v1/groups",
|
|
"POST /api/v1/groups/:id/members",
|
|
"GET /api/v1/groups/:id/members",
|
|
"DELETE /api/v1/groups/:id/members/:userId",
|
|
"DELETE /api/v1/groups/:id",
|
|
|
|
"POST /api/v1/ocr/jobs",
|
|
"GET /api/v1/ocr/jobs/:id",
|
|
|
|
"POST /api/v1/sync/ops",
|
|
"GET /api/v1/sync/permissions",
|
|
}
|
|
|
|
func TestRoutesMatchClientContract(t *testing.T) {
|
|
|
|
registered := map[string]bool{}
|
|
for _, route := range newRouter().Routes() {
|
|
registered[route.Method+" "+route.Path] = true
|
|
}
|
|
|
|
for _, want := range expectedRoutes {
|
|
if !registered[want] {
|
|
t.Errorf("missing route %q — must mirror mobile/api/client.ts", want)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// TestStaticFileRoutesListedBeforeParam (LOT 6 §1) : verrouille que les routes
|
|
// statiques /files/search et /files/folders restent déclarées avant
|
|
// /files/:id dans le contrat. Gin priorise déjà le statique sur le paramétré
|
|
// à l'exécution, mais l'ordre source documente l'intention ("/files/folders
|
|
// ne doit jamais être avalé par FilesGet avec id="folders"). Le comportement
|
|
// réel est couvert côté handlers (folders→200, :id="folders"→404).
|
|
func TestStaticFileRoutesListedBeforeParam(t *testing.T) {
|
|
index := map[string]int{}
|
|
for i, r := range expectedRoutes {
|
|
index[r] = i
|
|
}
|
|
for _, static := range []string{"GET /api/v1/files/search", "GET /api/v1/files/folders"} {
|
|
if index[static] > index["GET /api/v1/files/:id"] {
|
|
t.Errorf("contrat: %q doit rester listé avant %q (ordre §1)", static, "GET /api/v1/files/:id")
|
|
}
|
|
}
|
|
}
|