@copilotkit/react-native 1.57.0-canary.1778116520
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +54 -0
- package/dist/index.cjs +203 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +51 -0
- package/dist/index.d.mts +51 -0
- package/dist/index.mjs +101 -0
- package/dist/index.mjs.map +1 -0
- package/dist/polyfills/crypto.cjs +15 -0
- package/dist/polyfills/crypto.cjs.map +1 -0
- package/dist/polyfills/crypto.d.cts +1 -0
- package/dist/polyfills/crypto.d.mts +1 -0
- package/dist/polyfills/crypto.mjs +15 -0
- package/dist/polyfills/crypto.mjs.map +1 -0
- package/dist/polyfills/dom.cjs +59 -0
- package/dist/polyfills/dom.cjs.map +1 -0
- package/dist/polyfills/dom.d.cts +1 -0
- package/dist/polyfills/dom.d.mts +1 -0
- package/dist/polyfills/dom.mjs +59 -0
- package/dist/polyfills/dom.mjs.map +1 -0
- package/dist/polyfills/encoding.cjs +19 -0
- package/dist/polyfills/encoding.cjs.map +1 -0
- package/dist/polyfills/encoding.d.cts +1 -0
- package/dist/polyfills/encoding.d.mts +1 -0
- package/dist/polyfills/encoding.mjs +19 -0
- package/dist/polyfills/encoding.mjs.map +1 -0
- package/dist/polyfills/location.cjs +18 -0
- package/dist/polyfills/location.cjs.map +1 -0
- package/dist/polyfills/location.d.cts +1 -0
- package/dist/polyfills/location.d.mts +1 -0
- package/dist/polyfills/location.mjs +18 -0
- package/dist/polyfills/location.mjs.map +1 -0
- package/dist/polyfills/streams.cjs +20 -0
- package/dist/polyfills/streams.cjs.map +1 -0
- package/dist/polyfills/streams.d.cts +1 -0
- package/dist/polyfills/streams.d.mts +1 -0
- package/dist/polyfills/streams.mjs +20 -0
- package/dist/polyfills/streams.mjs.map +1 -0
- package/dist/polyfills.cjs +196 -0
- package/dist/polyfills.cjs.map +1 -0
- package/dist/polyfills.d.cts +1 -0
- package/dist/polyfills.d.mts +1 -0
- package/dist/polyfills.mjs +196 -0
- package/dist/polyfills.mjs.map +1 -0
- package/package.json +92 -0
- package/project.json +18 -0
- package/src/CopilotKitProvider.tsx +188 -0
- package/src/__tests__/copilotkit-provider.test.tsx +424 -0
- package/src/__tests__/headless-integration.test.tsx +378 -0
- package/src/__tests__/polyfills.test.ts +242 -0
- package/src/__tests__/setup.ts +9 -0
- package/src/__tests__/streaming-fetch.test.ts +486 -0
- package/src/index.ts +44 -0
- package/src/polyfills/crypto.ts +34 -0
- package/src/polyfills/dom.ts +85 -0
- package/src/polyfills/encoding.ts +20 -0
- package/src/polyfills/location.ts +30 -0
- package/src/polyfills/streams.ts +27 -0
- package/src/polyfills.ts +22 -0
- package/src/streaming-fetch.ts +336 -0
- package/src/types.d.ts +23 -0
- package/tsconfig.json +16 -0
- package/tsdown.config.ts +25 -0
- package/vitest.config.mjs +17 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { render, act } from "@testing-library/react";
|
|
3
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
|
|
4
|
+
|
|
5
|
+
// ─── Mocks ────────────────────────────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
// vi.hoisted runs before vi.mock factories, making these available to both
|
|
8
|
+
const hoisted = vi.hoisted(() => {
|
|
9
|
+
const _React = require("react");
|
|
10
|
+
return {
|
|
11
|
+
RealContext: _React.createContext(null),
|
|
12
|
+
MockCoreConstructor: vi.fn(),
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// Captured subscribers from copilotkit.subscribe()
|
|
17
|
+
let capturedSubscriber: Record<string, (...args: any[]) => void>;
|
|
18
|
+
let unsubscribeMock: ReturnType<typeof vi.fn>;
|
|
19
|
+
|
|
20
|
+
function createMockCore() {
|
|
21
|
+
return {
|
|
22
|
+
subscribe: vi.fn((subscriber: any) => {
|
|
23
|
+
capturedSubscriber = subscriber;
|
|
24
|
+
return { unsubscribe: unsubscribeMock };
|
|
25
|
+
}),
|
|
26
|
+
setRuntimeUrl: vi.fn(),
|
|
27
|
+
setRuntimeTransport: vi.fn(),
|
|
28
|
+
setHeaders: vi.fn(),
|
|
29
|
+
setProperties: vi.fn(),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let mockCoreInstance: ReturnType<typeof createMockCore>;
|
|
34
|
+
|
|
35
|
+
vi.mock("@copilotkit/react-core/v2/headless", () => {
|
|
36
|
+
// Regular function (not arrow) so it's new-able
|
|
37
|
+
function CopilotKitCoreReact(this: any, ...args: any[]) {
|
|
38
|
+
hoisted.MockCoreConstructor(...args);
|
|
39
|
+
const instance = hoisted.MockCoreConstructor.mock.results.at(-1)?.value;
|
|
40
|
+
if (instance) Object.assign(this, instance);
|
|
41
|
+
}
|
|
42
|
+
return { CopilotKitCoreReact };
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
vi.mock("@copilotkit/react-core/v2/context", () => {
|
|
46
|
+
const _React = require("react");
|
|
47
|
+
return {
|
|
48
|
+
CopilotKitContext: hoisted.RealContext,
|
|
49
|
+
LicenseContext: _React.createContext({
|
|
50
|
+
status: null,
|
|
51
|
+
license: null,
|
|
52
|
+
checkFeature: () => true,
|
|
53
|
+
getLimit: () => null,
|
|
54
|
+
}),
|
|
55
|
+
useLicenseContext: () => ({
|
|
56
|
+
status: null,
|
|
57
|
+
license: null,
|
|
58
|
+
checkFeature: () => true,
|
|
59
|
+
getLimit: () => null,
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
vi.mock("@copilotkit/shared", () => ({
|
|
65
|
+
createLicenseContextValue: () => ({
|
|
66
|
+
status: null,
|
|
67
|
+
license: null,
|
|
68
|
+
checkFeature: () => true,
|
|
69
|
+
getLimit: () => null,
|
|
70
|
+
}),
|
|
71
|
+
}));
|
|
72
|
+
|
|
73
|
+
// Import after mocks
|
|
74
|
+
import { CopilotKitProvider } from "../CopilotKitProvider";
|
|
75
|
+
|
|
76
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
77
|
+
|
|
78
|
+
function ContextReader({ onContext }: { onContext: (ctx: any) => void }) {
|
|
79
|
+
const ctx = useContext(hoisted.RealContext);
|
|
80
|
+
onContext(ctx);
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ─── Tests ────────────────────────────────────────────────────────────────────
|
|
85
|
+
|
|
86
|
+
describe("CopilotKitProvider (React Native)", () => {
|
|
87
|
+
beforeEach(() => {
|
|
88
|
+
unsubscribeMock = vi.fn();
|
|
89
|
+
mockCoreInstance = createMockCore();
|
|
90
|
+
hoisted.MockCoreConstructor.mockClear();
|
|
91
|
+
hoisted.MockCoreConstructor.mockReturnValue(mockCoreInstance);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
afterEach(() => {
|
|
95
|
+
vi.clearAllMocks();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// ── Initialization ──────────────────────────────────────────────────────
|
|
99
|
+
|
|
100
|
+
describe("initialization", () => {
|
|
101
|
+
it("creates CopilotKitCoreReact with correct config", () => {
|
|
102
|
+
render(
|
|
103
|
+
<CopilotKitProvider
|
|
104
|
+
runtimeUrl="https://api.test"
|
|
105
|
+
headers={{ auth: "token" }}
|
|
106
|
+
properties={{ key: "val" }}
|
|
107
|
+
>
|
|
108
|
+
<div />
|
|
109
|
+
</CopilotKitProvider>,
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
expect(hoisted.MockCoreConstructor).toHaveBeenCalledWith(
|
|
113
|
+
expect.objectContaining({
|
|
114
|
+
runtimeUrl: "https://api.test",
|
|
115
|
+
runtimeTransport: "auto",
|
|
116
|
+
headers: { auth: "token" },
|
|
117
|
+
properties: { key: "val" },
|
|
118
|
+
}),
|
|
119
|
+
);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("creates exactly one instance across re-renders", () => {
|
|
123
|
+
const { rerender } = render(
|
|
124
|
+
<CopilotKitProvider runtimeUrl="https://api.test/v1">
|
|
125
|
+
<div />
|
|
126
|
+
</CopilotKitProvider>,
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
rerender(
|
|
130
|
+
<CopilotKitProvider runtimeUrl="https://api.test/v2">
|
|
131
|
+
<div />
|
|
132
|
+
</CopilotKitProvider>,
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
expect(hoisted.MockCoreConstructor).toHaveBeenCalledTimes(1);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("maps useSingleEndpoint=true to transport 'single'", () => {
|
|
139
|
+
render(
|
|
140
|
+
<CopilotKitProvider runtimeUrl="https://api.test" useSingleEndpoint>
|
|
141
|
+
<div />
|
|
142
|
+
</CopilotKitProvider>,
|
|
143
|
+
);
|
|
144
|
+
expect(hoisted.MockCoreConstructor).toHaveBeenCalledWith(
|
|
145
|
+
expect.objectContaining({ runtimeTransport: "single" }),
|
|
146
|
+
);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it("maps useSingleEndpoint=false to transport 'rest'", () => {
|
|
150
|
+
render(
|
|
151
|
+
<CopilotKitProvider
|
|
152
|
+
runtimeUrl="https://api.test"
|
|
153
|
+
useSingleEndpoint={false}
|
|
154
|
+
>
|
|
155
|
+
<div />
|
|
156
|
+
</CopilotKitProvider>,
|
|
157
|
+
);
|
|
158
|
+
expect(hoisted.MockCoreConstructor).toHaveBeenCalledWith(
|
|
159
|
+
expect.objectContaining({ runtimeTransport: "rest" }),
|
|
160
|
+
);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it("defaults useSingleEndpoint to auto-detect", () => {
|
|
164
|
+
render(
|
|
165
|
+
<CopilotKitProvider runtimeUrl="https://api.test">
|
|
166
|
+
<div />
|
|
167
|
+
</CopilotKitProvider>,
|
|
168
|
+
);
|
|
169
|
+
expect(hoisted.MockCoreConstructor).toHaveBeenCalledWith(
|
|
170
|
+
expect.objectContaining({ runtimeTransport: "auto" }),
|
|
171
|
+
);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// ── Prop synchronization ────────────────────────────────────────────────
|
|
176
|
+
|
|
177
|
+
describe("prop synchronization", () => {
|
|
178
|
+
it("calls setRuntimeUrl when runtimeUrl changes", () => {
|
|
179
|
+
const { rerender } = render(
|
|
180
|
+
<CopilotKitProvider runtimeUrl="https://api.test/v1">
|
|
181
|
+
<div />
|
|
182
|
+
</CopilotKitProvider>,
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
rerender(
|
|
186
|
+
<CopilotKitProvider runtimeUrl="https://api.test/v2">
|
|
187
|
+
<div />
|
|
188
|
+
</CopilotKitProvider>,
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
expect(mockCoreInstance.setRuntimeUrl).toHaveBeenCalledWith(
|
|
192
|
+
"https://api.test/v2",
|
|
193
|
+
);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it("calls setHeaders when headers content changes", () => {
|
|
197
|
+
const { rerender } = render(
|
|
198
|
+
<CopilotKitProvider runtimeUrl="https://api.test" headers={{ a: "1" }}>
|
|
199
|
+
<div />
|
|
200
|
+
</CopilotKitProvider>,
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
mockCoreInstance.setHeaders.mockClear();
|
|
204
|
+
|
|
205
|
+
rerender(
|
|
206
|
+
<CopilotKitProvider runtimeUrl="https://api.test" headers={{ b: "2" }}>
|
|
207
|
+
<div />
|
|
208
|
+
</CopilotKitProvider>,
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
expect(mockCoreInstance.setHeaders).toHaveBeenCalledWith({ b: "2" });
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
it("does not re-fire setHeaders when content is identical (JSON-stabilized)", () => {
|
|
215
|
+
const { rerender } = render(
|
|
216
|
+
<CopilotKitProvider runtimeUrl="https://api.test" headers={{ a: "1" }}>
|
|
217
|
+
<div />
|
|
218
|
+
</CopilotKitProvider>,
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
mockCoreInstance.setHeaders.mockClear();
|
|
222
|
+
|
|
223
|
+
// New object reference but same content
|
|
224
|
+
rerender(
|
|
225
|
+
<CopilotKitProvider runtimeUrl="https://api.test" headers={{ a: "1" }}>
|
|
226
|
+
<div />
|
|
227
|
+
</CopilotKitProvider>,
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
expect(mockCoreInstance.setHeaders).not.toHaveBeenCalled();
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// ── Context provision ─────────────────────────────────────────────────
|
|
235
|
+
|
|
236
|
+
describe("context provision", () => {
|
|
237
|
+
it("provides copilotkit and executingToolCallIds via context", () => {
|
|
238
|
+
let ctx: any = null;
|
|
239
|
+
render(
|
|
240
|
+
<CopilotKitProvider runtimeUrl="https://api.test">
|
|
241
|
+
<ContextReader onContext={(c) => (ctx = c)} />
|
|
242
|
+
</CopilotKitProvider>,
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
expect(ctx).not.toBeNull();
|
|
246
|
+
// Structural equality — the `new` constructor copies props via Object.assign
|
|
247
|
+
expect(ctx.copilotkit).toEqual(mockCoreInstance);
|
|
248
|
+
expect(ctx.executingToolCallIds).toBeInstanceOf(Set);
|
|
249
|
+
expect(ctx.executingToolCallIds.size).toBe(0);
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
// ── Tool execution tracking ─────────────────────────────────────────────
|
|
254
|
+
|
|
255
|
+
describe("tool execution tracking", () => {
|
|
256
|
+
it("adds toolCallId on onToolExecutionStart", () => {
|
|
257
|
+
let ctx: any = null;
|
|
258
|
+
render(
|
|
259
|
+
<CopilotKitProvider runtimeUrl="https://api.test">
|
|
260
|
+
<ContextReader onContext={(c) => (ctx = c)} />
|
|
261
|
+
</CopilotKitProvider>,
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
act(() => {
|
|
265
|
+
capturedSubscriber.onToolExecutionStart({ toolCallId: "tc-1" });
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
expect(ctx.executingToolCallIds.has("tc-1")).toBe(true);
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it("removes toolCallId on onToolExecutionEnd", () => {
|
|
272
|
+
let ctx: any = null;
|
|
273
|
+
render(
|
|
274
|
+
<CopilotKitProvider runtimeUrl="https://api.test">
|
|
275
|
+
<ContextReader onContext={(c) => (ctx = c)} />
|
|
276
|
+
</CopilotKitProvider>,
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
act(() => {
|
|
280
|
+
capturedSubscriber.onToolExecutionStart({ toolCallId: "tc-1" });
|
|
281
|
+
});
|
|
282
|
+
act(() => {
|
|
283
|
+
capturedSubscriber.onToolExecutionEnd({ toolCallId: "tc-1" });
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
expect(ctx.executingToolCallIds.has("tc-1")).toBe(false);
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
it("handles multiple concurrent tool executions", () => {
|
|
290
|
+
let ctx: any = null;
|
|
291
|
+
render(
|
|
292
|
+
<CopilotKitProvider runtimeUrl="https://api.test">
|
|
293
|
+
<ContextReader onContext={(c) => (ctx = c)} />
|
|
294
|
+
</CopilotKitProvider>,
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
act(() => {
|
|
298
|
+
capturedSubscriber.onToolExecutionStart({ toolCallId: "tc-1" });
|
|
299
|
+
capturedSubscriber.onToolExecutionStart({ toolCallId: "tc-2" });
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
expect(ctx.executingToolCallIds.size).toBe(2);
|
|
303
|
+
|
|
304
|
+
act(() => {
|
|
305
|
+
capturedSubscriber.onToolExecutionEnd({ toolCallId: "tc-1" });
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
expect(ctx.executingToolCallIds.has("tc-1")).toBe(false);
|
|
309
|
+
expect(ctx.executingToolCallIds.has("tc-2")).toBe(true);
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it("is idempotent for duplicate start events", () => {
|
|
313
|
+
let ctx: any = null;
|
|
314
|
+
render(
|
|
315
|
+
<CopilotKitProvider runtimeUrl="https://api.test">
|
|
316
|
+
<ContextReader onContext={(c) => (ctx = c)} />
|
|
317
|
+
</CopilotKitProvider>,
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
act(() => {
|
|
321
|
+
capturedSubscriber.onToolExecutionStart({ toolCallId: "tc-1" });
|
|
322
|
+
capturedSubscriber.onToolExecutionStart({ toolCallId: "tc-1" });
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
expect(ctx.executingToolCallIds.size).toBe(1);
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
// ── Error handling ────────────────────────────────────────────────────
|
|
330
|
+
|
|
331
|
+
describe("error handling", () => {
|
|
332
|
+
it("forwards errors to onError prop when provided", () => {
|
|
333
|
+
const onError = vi.fn();
|
|
334
|
+
render(
|
|
335
|
+
<CopilotKitProvider runtimeUrl="https://api.test" onError={onError}>
|
|
336
|
+
<div />
|
|
337
|
+
</CopilotKitProvider>,
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
const testError = new Error("test error");
|
|
341
|
+
act(() => {
|
|
342
|
+
capturedSubscriber.onError({
|
|
343
|
+
error: testError,
|
|
344
|
+
code: "RUNTIME_ERROR",
|
|
345
|
+
context: { detail: "info" },
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
expect(onError).toHaveBeenCalledWith({
|
|
350
|
+
error: testError,
|
|
351
|
+
code: "RUNTIME_ERROR",
|
|
352
|
+
context: { detail: "info" },
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
it("logs to console.error when onError is not provided", () => {
|
|
357
|
+
const spy = vi.spyOn(console, "error").mockImplementation(() => {});
|
|
358
|
+
render(
|
|
359
|
+
<CopilotKitProvider runtimeUrl="https://api.test">
|
|
360
|
+
<div />
|
|
361
|
+
</CopilotKitProvider>,
|
|
362
|
+
);
|
|
363
|
+
|
|
364
|
+
act(() => {
|
|
365
|
+
capturedSubscriber.onError({
|
|
366
|
+
error: new Error("fail"),
|
|
367
|
+
code: "AGENT_ERROR",
|
|
368
|
+
context: {},
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
expect(spy).toHaveBeenCalledWith(
|
|
373
|
+
expect.stringContaining("AGENT_ERROR"),
|
|
374
|
+
expect.any(Error),
|
|
375
|
+
expect.any(Object),
|
|
376
|
+
);
|
|
377
|
+
spy.mockRestore();
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
it("picks up new onError callback without resubscribing (ref pattern)", () => {
|
|
381
|
+
const onError1 = vi.fn();
|
|
382
|
+
const onError2 = vi.fn();
|
|
383
|
+
|
|
384
|
+
const { rerender } = render(
|
|
385
|
+
<CopilotKitProvider runtimeUrl="https://api.test" onError={onError1}>
|
|
386
|
+
<div />
|
|
387
|
+
</CopilotKitProvider>,
|
|
388
|
+
);
|
|
389
|
+
|
|
390
|
+
rerender(
|
|
391
|
+
<CopilotKitProvider runtimeUrl="https://api.test" onError={onError2}>
|
|
392
|
+
<div />
|
|
393
|
+
</CopilotKitProvider>,
|
|
394
|
+
);
|
|
395
|
+
|
|
396
|
+
act(() => {
|
|
397
|
+
capturedSubscriber.onError({
|
|
398
|
+
error: new Error("test"),
|
|
399
|
+
code: "RUNTIME_ERROR",
|
|
400
|
+
context: {},
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
expect(onError1).not.toHaveBeenCalled();
|
|
405
|
+
expect(onError2).toHaveBeenCalled();
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
// ── Cleanup ───────────────────────────────────────────────────────────
|
|
410
|
+
|
|
411
|
+
describe("cleanup", () => {
|
|
412
|
+
it("unsubscribes when component unmounts", () => {
|
|
413
|
+
const { unmount } = render(
|
|
414
|
+
<CopilotKitProvider runtimeUrl="https://api.test">
|
|
415
|
+
<div />
|
|
416
|
+
</CopilotKitProvider>,
|
|
417
|
+
);
|
|
418
|
+
|
|
419
|
+
unmount();
|
|
420
|
+
|
|
421
|
+
expect(unsubscribeMock).toHaveBeenCalled();
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
});
|