Skip to content

Commit a15e1c3

Browse files
committed
add type tests
1 parent 27ffb8b commit a15e1c3

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

packages/graph-framework/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "",
55
"type": "module",
66
"scripts": {
7-
"test": "vitest run",
7+
"test": "vitest run --typecheck",
88
"ts:check": "tsc --noEmit",
99
"lint": "echo 'No linting configured'"
1010
},

packages/graph-framework/src/index.test.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import "@testing-library/jest-dom/vitest";
22
import { act, cleanup, renderHook } from "@testing-library/react";
33
import React from "react";
4-
import { afterEach, beforeEach, describe, expect, it } from "vitest";
4+
import {
5+
afterEach,
6+
beforeEach,
7+
describe,
8+
expect,
9+
expectTypeOf,
10+
it,
11+
} from "vitest";
512
import { createFunctions, repo, type } from "./context.js";
613

714
afterEach(() => {
@@ -168,6 +175,27 @@ describe("Library Tests", () => {
168175
// Check author
169176
expect(event.author.name).toBe("Charlie");
170177
expect(event.author.email).toBe("[email protected]");
178+
179+
expectTypeOf(event).toMatchTypeOf<{
180+
name: string;
181+
participants: {
182+
name: string;
183+
age: number;
184+
badges: {
185+
name: string;
186+
}[];
187+
}[];
188+
author: {
189+
name: string;
190+
age: number;
191+
badges: {
192+
name: string;
193+
}[];
194+
} & {
195+
name: string;
196+
email: string;
197+
};
198+
}>();
171199
});
172200

173201
it("should create entities with nested relations and query them", () => {

0 commit comments

Comments
 (0)