fix(session): add typed message lookup wrappers (#27269)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user