Merge remote-tracking branch 'origin/main' into codex/housekeeping-rebuild-stepwise
# Conflicts: # .env.example # src/features/housekeeping/foundation/preview-route-contract.test.ts
This commit is contained in:
commit
52e00854a2
25 files changed
+1865
-654
No files matched your search
@@ -3,14 +3,24 @@ import { isHousekeepingPreviewEnabled } from "./preview-gate";
|
||||
|
||||
describe("isHousekeepingPreviewEnabled", () => {
|
||||
it.each([
|
||||
["development", true, true],
|
||||
["test", true, true],
|
||||
["development", false, false],
|
||||
["production", true, false],
|
||||
["production", false, false],
|
||||
] as const)("NODE_ENV=%s flag=%s => %s", (nodeEnv, flag, expected) => {
|
||||
expect(isHousekeepingPreviewEnabled({ nodeEnv, flag })).toBe(expected);
|
||||
});
|
||||
["development", true, false, true],
|
||||
["test", true, false, true],
|
||||
["development", false, true, false],
|
||||
["production", true, true, true],
|
||||
["production", true, false, false],
|
||||
["production", false, true, false],
|
||||
] as const)(
|
||||
"NODE_ENV=%s flag=%s productionAccess=%s => %s",
|
||||
(nodeEnv, flag, hasProductionAccess, expected) => {
|
||||
expect(
|
||||
isHousekeepingPreviewEnabled({
|
||||
nodeEnv,
|
||||
flag,
|
||||
hasProductionAccess,
|
||||
}),
|
||||
).toBe(expected);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe("HOUSEKEEPING_NEXT_PREVIEW_ENABLED", () => {
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
export function isHousekeepingPreviewEnabled(input: {
|
||||
nodeEnv: "development" | "test" | "production";
|
||||
flag: boolean;
|
||||
hasProductionAccess?: boolean;
|
||||
}): boolean {
|
||||
return input.nodeEnv !== "production" && input.flag;
|
||||
return (
|
||||
input.flag &&
|
||||
(input.nodeEnv !== "production" || input.hasProductionAccess === true)
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user