| ... | @@ -7,6 +7,7 @@ import * as NodeCryptoLayer from "@effect/platform-node/NodeCrypto"; | ... | @@ -7,6 +7,7 @@ import * as NodeCryptoLayer from "@effect/platform-node/NodeCrypto"; |
| 7 | import { describe, expect, it } from "@effect/vitest"; | 7 | import { describe, expect, it } from "@effect/vitest"; |
| 8 | import * as Effect from "effect/Effect"; | 8 | import * as Effect from "effect/Effect"; |
| 9 | import * as Layer from "effect/Layer"; | 9 | import * as Layer from "effect/Layer"; |
| | 10 | import * as Logger from "effect/Logger"; |
| 10 | import * as Redacted from "effect/Redacted"; | 11 | import * as Redacted from "effect/Redacted"; |
| 11 | import { FetchHttpClient } from "effect/unstable/http"; | 12 | import { FetchHttpClient } from "effect/unstable/http"; |
| 12 | | 13 | |
| ... | @@ -232,6 +233,11 @@ describe("MobileRegistrations", () => { | ... | @@ -232,6 +233,11 @@ describe("MobileRegistrations", () => { |
| 232 | }); | 233 | }); |
| 233 | | 234 | |
| 234 | it.effect("keeps device registration successful when activity replay fails", () => { | 235 | it.effect("keeps device registration successful when activity replay fails", () => { |
| | 236 | const messages: unknown[] = []; |
| | 237 | const logger = Logger.make(({ message }) => { |
| | 238 | messages.push(message); |
| | 239 | }); |
| | 240 | |
| 235 | return Effect.gen(function* () { | 241 | return Effect.gen(function* () { |
| 236 | const result = yield* Effect.gen(function* () { | 242 | const result = yield* Effect.gen(function* () { |
| 237 | const registrations = yield* MobileRegistrations.MobileRegistrations; | 243 | const registrations = yield* MobileRegistrations.MobileRegistrations; |
| ... | @@ -250,7 +256,7 @@ describe("MobileRegistrations", () => { | ... | @@ -250,7 +256,7 @@ describe("MobileRegistrations", () => { |
| 250 | Effect.fail( | 256 | Effect.fail( |
| 251 | new AgentActivityRows.AgentActivityRowListPersistenceError({ | 257 | new AgentActivityRows.AgentActivityRowListPersistenceError({ |
| 252 | userId: "dev:julius", | 258 | userId: "dev:julius", |
| 253 | cause: "replay failed", | 259 | cause: "sensitive device replay detail", |
| 254 | }), | 260 | }), |
| 255 | ), | 261 | ), |
| 256 | }), | 262 | }), |
| ... | @@ -262,7 +268,11 @@ describe("MobileRegistrations", () => { | ... | @@ -262,7 +268,11 @@ describe("MobileRegistrations", () => { |
| 262 | ); | 268 | ); |
| 263 | | 269 | |
| 264 | expect(result).toEqual({ ok: true }); | 270 | expect(result).toEqual({ ok: true }); |
| 265 | }); | 271 | expect(messages).toContainEqual([ |
| | 272 | "device registration activity replay failed", |
| | 273 | { errorTag: "AgentActivityRowListPersistenceError" }, |
| | 274 | ]); |
| | 275 | }).pipe(Effect.provide(Logger.layer([logger], { mergeWithExisting: false }))); |
| 266 | }); | 276 | }); |
| 267 | | 277 | |
| 268 | it.effect("unregisters the current user's device", () => { | 278 | it.effect("unregisters the current user's device", () => { |