fix(storage): type not found errors (#27265)
This commit is contained in:
parent
d93a06431e
commit
e9a29e4908
6 changed files with 51 additions and 21 deletions
|
|
@ -74,20 +74,23 @@ describe("Storage", () => {
|
|||
it.live("maps missing reads to NotFoundError", () =>
|
||||
Effect.gen(function* () {
|
||||
const { root, svc } = yield* scope()
|
||||
const exit = yield* svc.read([...root, "missing", "value"]).pipe(Effect.exit)
|
||||
expect(Exit.isFailure(exit)).toBe(true)
|
||||
const error = yield* Effect.flip(svc.read([...root, "missing", "value"]))
|
||||
expect(error).toBeInstanceOf(Storage.NotFoundError)
|
||||
expect(error._tag).toBe("NotFoundError")
|
||||
expect(error.message).toContain(path.join(...root, "missing", "value") + ".json")
|
||||
}),
|
||||
)
|
||||
|
||||
it.live("update on missing key throws NotFoundError", () =>
|
||||
Effect.gen(function* () {
|
||||
const { root, svc } = yield* scope()
|
||||
const exit = yield* svc
|
||||
.update<{ value: number }>([...root, "missing", "key"], (draft) => {
|
||||
const error = yield* Effect.flip(
|
||||
svc.update<{ value: number }>([...root, "missing", "key"], (draft) => {
|
||||
draft.value += 1
|
||||
})
|
||||
.pipe(Effect.exit)
|
||||
expect(Exit.isFailure(exit)).toBe(true)
|
||||
}),
|
||||
)
|
||||
expect(error).toBeInstanceOf(Storage.NotFoundError)
|
||||
expect(error._tag).toBe("NotFoundError")
|
||||
}),
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue