-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathmultirange.test.ts
45 lines (37 loc) · 1 KB
/
multirange.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import type { Client, MultiRange } from "edgedb";
import e from "./dbschema/edgeql-js";
import { setupTests, tc, teardownTests } from "./setupTeardown";
import type { WithMultiRange } from "./dbschema/interfaces";
interface BaseObject {
id: string;
}
interface test_WithMultiRange extends BaseObject {
ranges: MultiRange<number>;
}
describe("multirange", () => {
let client: Client;
beforeAll(async () => {
const setup = await setupTests();
({ client } = setup);
});
afterAll(async () => {
await teardownTests(client);
}, 10_000);
test("check generated interfaces", () => {
tc.assert<tc.IsExact<WithMultiRange, test_WithMultiRange>>(true);
});
test("inferred return type + literal encoding", async () => {
const query = e.select(e.WithMultiRange, () => ({
ranges: true,
}));
const result = await query.run(client);
tc.assert<
tc.IsExact<
typeof result,
{
ranges: MultiRange<number>;
}[]
>
>(true);
});
});