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

entities.test.ts

36 lines1.1 KB

1import { scopeThreadRef } from "@t3tools/client-runtime/environment";
2import { EnvironmentId, ThreadId } from "@t3tools/contracts";
3import { describe, expect, it } from "vite-plus/test";
4​
5import { resolveThreadDetailRef } from "./entities";
6​
7const threadRef = scopeThreadRef(EnvironmentId.make("environment-1"), ThreadId.make("thread-1"));
8​
9describe("resolveThreadDetailRef", () => {
10 it("does not subscribe to a reserved draft thread before it enters the shell index", () => {
11 expect(
12 resolveThreadDetailRef(threadRef, {
13 shellExists: false,
14 waitForShell: true,
15 }),
16 ).toBeNull();
17 });
18​
19 it("subscribes once the reserved draft thread enters the shell index", () => {
20 expect(
21 resolveThreadDetailRef(threadRef, {
22 shellExists: true,
23 waitForShell: true,
24 }),
25 ).toBe(threadRef);
26 });
27​
28 it("keeps direct server-thread lookups enabled when the shell has not loaded it", () => {
29 expect(
30 resolveThreadDetailRef(threadRef, {
31 shellExists: false,
32 waitForShell: false,
33 }),
34 ).toBe(threadRef);
35 });
36});