Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

session.test.ts

21 lines707 Bytes

1import { describe, expect, it } from "@effect/vitest";
2import * as Effect from "effect/Effect";
3import * as Option from "effect/Option";
4import * as Schema from "effect/Schema";
5​
6import { initialConfigOption } from "./session.ts";
7​
8class TestConfigError extends Schema.TaggedErrorClass<TestConfigError>()("TestConfigError", {
9 message: Schema.String,
10}) {}
11​
12describe("environment session state", () => {
13 it.effect("turns an initial config failure into an empty value", () =>
14 Effect.gen(function* () {
15 const result = yield* initialConfigOption(
16 Effect.fail(new TestConfigError({ message: "temporary failure" })),
17 );
18 expect(Option.isNone(result)).toBe(true);
19 }),
20 );
21});