Coalesce quota refreshes and consolidate shared helpers
Some checks failed
Deploy Sokko G / deploy (push) Failing after 2s

This commit is contained in:
Shinuwa 2026-09-10 20:03:57 +02:00
parent a4cf633ab4
commit 748415082b
19 changed files with 216 additions and 64 deletions

View file

@ -0,0 +1,20 @@
// Rôle : vérifie le parsing .env, la priorité du processus et les fichiers facultatifs.
import { test } from "node:test";
import assert from "node:assert/strict";
import { loadProjectEnv } from "../scripts/load-project-env.mjs";
for (const existing of ["9999", ""]) {
test(`project env preserves an existing ${existing ? "nonempty" : "empty"} value`, (t) => {
const keys = ["SOKKOG_ENV_FIXTURE_PORT", "SOKKOG_ENV_FIXTURE_QUOTED", "SOKKOG_ENV_FIXTURE_COMMENT"];
const previous = keys.map((key) => process.env[key]);
t.after(() => keys.forEach((key, index) => {
if (previous[index] === undefined) delete process.env[key];
else process.env[key] = previous[index];
}));
keys.forEach((key) => { delete process.env[key]; });
process.env.SOKKOG_ENV_FIXTURE_PORT = existing;
loadProjectEnv("tests/fixtures/project-env.txt");
loadProjectEnv("tests/fixtures/missing-env-file");
assert.deepEqual(keys.map((key) => process.env[key]), [existing, "value # inside", "value"]);
});
}