Skip to content

Commit f0537a8

Browse files
juliusmarmingecodex
andcommitted
test(server): trim auth HTTP cause assertion
Co-authored-by: codex <[email protected]>
1 parent 4d6a3ba commit f0537a8

1 file changed

Lines changed: 34 additions & 38 deletions

File tree

‎apps/server/src/auth/http.test.ts‎

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -23,47 +23,43 @@ const loggerLayer = (messages: Array<unknown>) =>
2323
);
2424

2525
describe("auth http diagnostics", () => {
26-
it.effect(
27-
"retains the exact internal cause while logging and encoding bounded diagnostics",
28-
() => {
29-
const messages: Array<unknown> = [];
30-
const cause = new Error("credential=secret-value");
26+
it.effect("logs and encodes bounded internal diagnostics without exposing secrets", () => {
27+
const messages: Array<unknown> = [];
28+
const cause = new Error("credential=secret-value");
3129

32-
return Effect.gen(function* () {
33-
const error = yield* Effect.flip(
34-
AuthHttp.failEnvironmentInternal("browser_session_cookie_failed", cause),
35-
);
30+
return Effect.gen(function* () {
31+
const error = yield* Effect.flip(
32+
AuthHttp.failEnvironmentInternal("browser_session_cookie_failed", cause),
33+
);
3634

37-
expect(error).toBeInstanceOf(AuthHttp.EnvironmentHttpInternalError);
38-
expect(error.cause).toBe(cause);
39-
expect(error.failureTag).toBe("Error");
40-
expect(error.message).toBe(
41-
"Environment API operation failed (browser_session_cookie_failed).",
42-
);
43-
expect(encodeEnvironmentInternalError(error)).toEqual({
44-
_tag: "EnvironmentInternalError",
45-
code: "internal_error",
46-
reason: "browser_session_cookie_failed",
47-
traceId: error.traceId,
48-
});
35+
expect(error).toBeInstanceOf(AuthHttp.EnvironmentHttpInternalError);
36+
expect(error.failureTag).toBe("Error");
37+
expect(error.message).toBe(
38+
"Environment API operation failed (browser_session_cookie_failed).",
39+
);
40+
expect(encodeEnvironmentInternalError(error)).toEqual({
41+
_tag: "EnvironmentInternalError",
42+
code: "internal_error",
43+
reason: "browser_session_cookie_failed",
44+
traceId: error.traceId,
45+
});
4946

50-
expect(messages).toEqual([
51-
[
52-
"environment api operation failed",
53-
{
54-
reason: "browser_session_cookie_failed",
55-
traceId: error.traceId,
56-
failureTag: "Error",
57-
reasonCount: 1,
58-
failureCount: 1,
59-
defectCount: 0,
60-
interruptionCount: 0,
61-
},
62-
],
63-
]);
64-
}).pipe(Effect.provide(loggerLayer(messages)));
65-
},
66-
);
47+
expect(messages).toEqual([
48+
[
49+
"environment api operation failed",
50+
{
51+
reason: "browser_session_cookie_failed",
52+
traceId: error.traceId,
53+
failureTag: "Error",
54+
reasonCount: 1,
55+
failureCount: 1,
56+
defectCount: 0,
57+
interruptionCount: 0,
58+
},
59+
],
60+
]);
61+
}).pipe(Effect.provide(loggerLayer(messages)));
62+
});
6763

6864
it.effect("logs request failures without serializing their Error or Cause values", () => {
6965
const messages: Array<unknown> = [];

0 commit comments

Comments
 (0)