22 lines
707 B
TypeScript
22 lines
707 B
TypeScript
import { describe, expect, it } from "@effect/vitest";
|
|
import * as Effect from "effect/Effect";
|
|
import * as Option from "effect/Option";
|
|
import * as Schema from "effect/Schema";
|
|
|
|
import { initialConfigOption } from "./session.ts";
|
|
|
|
class TestConfigError extends Schema.TaggedErrorClass<TestConfigError>()("TestConfigError", {
|
|
message: Schema.String,
|
|
}) {}
|
|
|
|
describe("environment session state", () => {
|
|
it.effect("turns an initial config failure into an empty value", () =>
|
|
Effect.gen(function* () {
|
|
const result = yield* initialConfigOption(
|
|
Effect.fail(new TestConfigError({ message: "temporary failure" })),
|
|
);
|
|
expect(Option.isNone(result)).toBe(true);
|
|
}),
|
|
);
|
|
});
|