Skip to content

Commit 54a3f2a

Browse files
committed
fix environment rules test
1 parent 77831ca commit 54a3f2a

File tree

1 file changed

+1
-43
lines changed

1 file changed

+1
-43
lines changed

apps/webapp/test/environmentVariableRules.test.ts

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,6 @@ describe("removeBlacklistedVariables", () => {
1515
expect(result).toEqual([{ key: "NORMAL_VAR", value: "normal" }]);
1616
});
1717

18-
it("should remove variables with blacklisted prefixes", () => {
19-
const variables: EnvironmentVariable[] = [
20-
{ key: "OTEL_SERVICE_NAME", value: "my-service" },
21-
{ key: "OTEL_TRACE_SAMPLER", value: "always_on" },
22-
{ key: "NORMAL_VAR", value: "normal" },
23-
];
24-
25-
const result = removeBlacklistedVariables(variables);
26-
27-
expect(result).toEqual([{ key: "NORMAL_VAR", value: "normal" }]);
28-
});
29-
30-
it("should keep whitelisted variables even if they match a blacklisted prefix", () => {
31-
const variables: EnvironmentVariable[] = [
32-
{ key: "OTEL_LOG_LEVEL", value: "debug" },
33-
{ key: "OTEL_SERVICE_NAME", value: "my-service" },
34-
{ key: "NORMAL_VAR", value: "normal" },
35-
];
36-
37-
const result = removeBlacklistedVariables(variables);
38-
39-
expect(result).toEqual([
40-
{ key: "OTEL_LOG_LEVEL", value: "debug" },
41-
{ key: "NORMAL_VAR", value: "normal" },
42-
]);
43-
});
44-
4518
it("should handle empty input array", () => {
4619
const variables: EnvironmentVariable[] = [];
4720

@@ -53,8 +26,6 @@ describe("removeBlacklistedVariables", () => {
5326
it("should handle mixed case variables", () => {
5427
const variables: EnvironmentVariable[] = [
5528
{ key: "trigger_secret_key", value: "secret123" }, // Different case
56-
{ key: "OTEL_LOG_LEVEL", value: "debug" },
57-
{ key: "otel_service_name", value: "my-service" }, // Different case
5829
{ key: "NORMAL_VAR", value: "normal" },
5930
];
6031

@@ -64,38 +35,26 @@ describe("removeBlacklistedVariables", () => {
6435
// Note: The function is case-sensitive, so different case variables should pass through
6536
expect(result).toEqual([
6637
{ key: "trigger_secret_key", value: "secret123" },
67-
{ key: "OTEL_LOG_LEVEL", value: "debug" },
68-
{ key: "otel_service_name", value: "my-service" },
6938
{ key: "NORMAL_VAR", value: "normal" },
7039
]);
7140
});
7241

7342
it("should handle variables with empty values", () => {
7443
const variables: EnvironmentVariable[] = [
7544
{ key: "TRIGGER_SECRET_KEY", value: "" },
76-
{ key: "OTEL_SERVICE_NAME", value: "" },
77-
{ key: "OTEL_LOG_LEVEL", value: "" },
7845
{ key: "NORMAL_VAR", value: "" },
7946
];
8047

8148
const result = removeBlacklistedVariables(variables);
8249

83-
expect(result).toEqual([
84-
{ key: "OTEL_LOG_LEVEL", value: "" },
85-
{ key: "NORMAL_VAR", value: "" },
86-
]);
50+
expect(result).toEqual([{ key: "NORMAL_VAR", value: "" }]);
8751
});
8852

8953
it("should handle all types of rules in a single array", () => {
9054
const variables: EnvironmentVariable[] = [
9155
// Exact matches (should be removed)
9256
{ key: "TRIGGER_SECRET_KEY", value: "secret123" },
9357
{ key: "TRIGGER_API_URL", value: "https://api.example.com" },
94-
// Prefix matches (should be removed)
95-
{ key: "OTEL_SERVICE_NAME", value: "my-service" },
96-
{ key: "OTEL_TRACE_SAMPLER", value: "always_on" },
97-
// Whitelist exception (should be kept)
98-
{ key: "OTEL_LOG_LEVEL", value: "debug" },
9958
// Normal variables (should be kept)
10059
{ key: "NORMAL_VAR", value: "normal" },
10160
{ key: "DATABASE_URL", value: "postgres://..." },
@@ -104,7 +63,6 @@ describe("removeBlacklistedVariables", () => {
10463
const result = removeBlacklistedVariables(variables);
10564

10665
expect(result).toEqual([
107-
{ key: "OTEL_LOG_LEVEL", value: "debug" },
10866
{ key: "NORMAL_VAR", value: "normal" },
10967
{ key: "DATABASE_URL", value: "postgres://..." },
11068
]);

0 commit comments

Comments
 (0)