MCPcopy
hub / github.com/TanStack/ai / renderInjectChat

Function renderInjectChat

packages/ai-angular/tests/test-utils.ts:37–59  ·  view source on GitHub ↗
(
  options?: T,
)

Source from the content-addressed store, hash-verified

35 * `result` accessor plus `flush` (runs change detection) and `destroy`.
36 */
37export function renderInjectChat<T extends InjectChatOptions>(
38 options?: T,
39): {
40 result: InjectChatResult
41 flush: () => void
42 destroy: () => void
43} {
44 @Component({ standalone: true, template: '' })
45 class HostComponent {
46 chat = injectChat(options as any)
47 }
48
49 const fixture = TestBed.createComponent(HostComponent)
50 fixture.detectChanges()
51
52 return {
53 get result() {
54 return fixture.componentInstance.chat
55 },
56 flush: () => fixture.detectChanges(),
57 destroy: () => fixture.destroy(),
58 }
59}

Callers 1

Calls 1

destroyMethod · 0.65

Tested by

no test coverage detected