import { scopeThreadRef } from "@t3tools/client-runtime/environment";import { EnvironmentId, ThreadId } from "@t3tools/contracts";import { describe, expect, it } from "vite-plus/test"; import { resolveThreadDetailRef } from "./entities"; const threadRef = scopeThreadRef(EnvironmentId.make("environment-1"), ThreadId.make("thread-1")); describe("resolveThreadDetailRef", () => { it("does not subscribe to a reserved draft thread before it enters the shell index", () => { expect( resolveThreadDetailRef(threadRef, { shellExists: false, waitForShell: true, }), ).toBeNull(); }); it("subscribes once the reserved draft thread enters the shell index", () => { expect( resolveThreadDetailRef(threadRef, { shellExists: true, waitForShell: true, }), ).toBe(threadRef); }); it("keeps direct server-thread lookups enabled when the shell has not loaded it", () => { expect( resolveThreadDetailRef(threadRef, { shellExists: false, waitForShell: false, }), ).toBe(threadRef); });});
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
import { describe, expect, it } from "vite-plus/test";
import { resolveThreadDetailRef } from "./entities";
const threadRef = scopeThreadRef(EnvironmentId.make("environment-1"), ThreadId.make("thread-1"));
describe("resolveThreadDetailRef", () => {
it("does not subscribe to a reserved draft thread before it enters the shell index", () => {
expect(
resolveThreadDetailRef(threadRef, {
shellExists: false,
waitForShell: true,
}),
).toBeNull();
});
it("subscribes once the reserved draft thread enters the shell index", () => {
expect(
resolveThreadDetailRef(threadRef, {
shellExists: true,
waitForShell: true,
}),
).toBe(threadRef);
});
it("keeps direct server-thread lookups enabled when the shell has not loaded it", () => {
expect(
resolveThreadDetailRef(threadRef, {
shellExists: false,
waitForShell: false,
}),
).toBe(threadRef);
});
});