fix(session): add typed message lookup wrappers (#27269)

This commit is contained in:
Shoubhit Dash
2026-05-13 13:04:07 +05:30
committed by GitHub
parent e9a29e4908
commit fed043a1ad
3 changed files with 49 additions and 10 deletions

View File

@@ -205,6 +205,15 @@ describe("MessageV2.page", () => {
}),
)
it.instance("fails pageEffect with NotFoundError for non-existent session", () =>
Effect.gen(function* () {
const fake = "non-existent-session" as SessionID
const error = yield* Effect.flip(MessageV2.pageEffect({ sessionID: fake, limit: 10 }))
expect(error).toBeInstanceOf(NotFoundError)
expect(error.message).toBe(`Session not found: ${fake}`)
}),
)
it.instance("handles exact limit boundary", () =>
withSession(({ sessionID }) =>
Effect.gen(function* () {
@@ -492,6 +501,17 @@ describe("MessageV2.get", () => {
),
)
it.instance("fails getEffect with NotFoundError for non-existent message", () =>
withSession(({ sessionID }) =>
Effect.gen(function* () {
const messageID = MessageID.ascending()
const error = yield* Effect.flip(MessageV2.getEffect({ sessionID, messageID }))
expect(error).toBeInstanceOf(NotFoundError)
expect(error.message).toBe(`Message not found: ${messageID}`)
}),
),
)
it.instance("scopes by session id", () =>
Effect.gen(function* () {
const session = yield* SessionNs.Service