chore: initialize from frontend template 4dc033c
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
type Result<T, E> =
|
||||
| Readonly<{ ok: true; value: T }>
|
||||
| Readonly<{ ok: false; error: E }>;
|
||||
|
||||
function summarize(result: Result<number, string>): string {
|
||||
return result.ok ? String(result.value) : result.error;
|
||||
}
|
||||
|
||||
describe("TypeScript test tooling", () => {
|
||||
it("type-checks and executes discriminated unions in the test project", () => {
|
||||
expect(summarize({ ok: true, value: 42 })).toBe("42");
|
||||
expect(summarize({ ok: false, error: "failed" })).toBe("failed");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user