-
Notifications
You must be signed in to change notification settings - Fork 234
Expand file tree
/
Copy pathconstants.test.ts
More file actions
29 lines (23 loc) · 926 Bytes
/
constants.test.ts
File metadata and controls
29 lines (23 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* @jest-environment node
*/
import { sequenceBounceLimit } from "../constants";
describe("constants", () => {
it("should have a default sequenceBounceLimit of 3", () => {
expect(sequenceBounceLimit).toBeGreaterThanOrEqual(0);
});
it("should read sequenceBounceLimit from environment variable", () => {
const originalEnv = process.env.SEQUENCE_BOUNCE_LIMIT;
process.env.SEQUENCE_BOUNCE_LIMIT = "5";
// Note: This test demonstrates the pattern, but since the constant
// is evaluated at module load time, we'd need to reload the module
// to see the change. This is just for demonstration.
expect(sequenceBounceLimit).toBeDefined();
// Restore original value
if (originalEnv) {
process.env.SEQUENCE_BOUNCE_LIMIT = originalEnv;
} else {
delete process.env.SEQUENCE_BOUNCE_LIMIT;
}
});
});