@@ -0,0 +1,27 @@
|
||||
// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
|
||||
// The one agent setting of the app (G3j): how many days a finished run is kept before the hourly sweep
|
||||
// deletes it. A whole number of days from 1 to 3650, 90 by default; anything else is refused with the name
|
||||
// of the variable, never its value.
|
||||
|
||||
import { agentRunRetentionDaysOf } from "@app/config"
|
||||
import { describe, expect, it } from "vitest"
|
||||
|
||||
describe("AGENT_RUN_RETENTION_DAYS", () => {
|
||||
it("is 90 days when unset or blank, and the value it is set to otherwise", () => {
|
||||
expect(agentRunRetentionDaysOf({})).toBe(90)
|
||||
expect(agentRunRetentionDaysOf({ AGENT_RUN_RETENTION_DAYS: " " })).toBe(90)
|
||||
expect(agentRunRetentionDaysOf({ AGENT_RUN_RETENTION_DAYS: " 30 " })).toBe(30)
|
||||
expect(agentRunRetentionDaysOf({ AGENT_RUN_RETENTION_DAYS: "1" })).toBe(1)
|
||||
expect(agentRunRetentionDaysOf({ AGENT_RUN_RETENTION_DAYS: "3650" })).toBe(3650)
|
||||
})
|
||||
|
||||
it.each(["0", "3651", "1.5", "-3", "ninety"])(
|
||||
"refuses %s with a message that names the variable and not the value",
|
||||
(value) => {
|
||||
// The message is fixed text: it cannot echo what was set, so it cannot leak a value into a log.
|
||||
expect(() => agentRunRetentionDaysOf({ AGENT_RUN_RETENTION_DAYS: value })).toThrow(
|
||||
new Error("AGENT_RUN_RETENTION_DAYS must be a whole number of days from 1 to 3650"),
|
||||
)
|
||||
},
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user