opencode-copilot-delegate 0.12.1 → 0.13.0
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/CHANGELOG.md +19 -1
- package/README.md +16 -16
- package/dist/index.js +20666 -14568
- package/dist/lib/normalize-tool-arg-schemas.d.ts +1 -1
- package/dist/lib/process-global.d.ts +18 -0
- package/dist/lib/tool.d.ts +25 -0
- package/dist/runtime/plugin-singleton.d.ts +60 -36
- package/dist/runtime/rpc-paths.d.ts +6 -0
- package/dist/runtime/rpc-port-sweep.d.ts +38 -0
- package/dist/runtime/rpc-server.d.ts +10 -0
- package/dist/tools/cancel.d.ts +3 -9
- package/dist/tools/delegate.d.ts +8 -19
- package/dist/tools/output.d.ts +5 -13
- package/dist/tools/resume.d.ts +13 -15
- package/dist/tui/index.js +2818 -10922
- package/dist/tui/status-dialogs.d.ts +17 -0
- package/dist/tui/status-format.d.ts +10 -0
- package/package.json +17 -13
- package/src/tui/index.tsx +11 -42
- package/src/tui/rpc-client.ts +5 -13
- package/src/tui/status-dialogs.tsx +243 -0
- package/src/tui/{components/row.tsx → status-format.ts} +10 -6
- package/dist/tui/__tests__/confirm-card.test.d.ts +0 -2
- package/dist/tui/__tests__/index.test.d.ts +0 -1
- package/dist/tui/__tests__/modal-list.test.d.ts +0 -1
- package/dist/tui/__tests__/rpc-client.test.d.ts +0 -1
- package/dist/tui/components/confirm-card.d.ts +0 -12
- package/dist/tui/components/modal-list.d.ts +0 -16
- package/dist/tui/components/row.d.ts +0 -6
- package/src/tui/__tests__/confirm-card.test.tsx +0 -516
- package/src/tui/__tests__/index.test.ts +0 -561
- package/src/tui/__tests__/modal-list.test.tsx +0 -518
- package/src/tui/__tests__/rpc-client.test.ts +0 -507
- package/src/tui/components/confirm-card.tsx +0 -252
- package/src/tui/components/modal-list.tsx +0 -232
|
@@ -1,518 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test'
|
|
2
|
-
import { type JSX, testRender } from '@opentui/solid'
|
|
3
|
-
|
|
4
|
-
type TaskStatus = 'running' | 'cancelling' | 'complete' | 'failed' | 'cancelled'
|
|
5
|
-
|
|
6
|
-
type TaskRow = {
|
|
7
|
-
taskId: string
|
|
8
|
-
status: TaskStatus
|
|
9
|
-
agent: string
|
|
10
|
-
model: string
|
|
11
|
-
elapsedMs: number
|
|
12
|
-
toolCallCount: number
|
|
13
|
-
startedAt: number
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type TasksListResponse = {
|
|
17
|
-
tasks: TaskRow[]
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
type ModalListClock = {
|
|
21
|
-
now(): number
|
|
22
|
-
setInterval(fn: () => void, delayMs: number): unknown
|
|
23
|
-
clearInterval(handle: unknown): void
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
type ModalListProps = {
|
|
27
|
-
rpc: {
|
|
28
|
-
tasksList(): Promise<TasksListResponse>
|
|
29
|
-
}
|
|
30
|
-
onClose: () => void
|
|
31
|
-
onLoadError?: (error: unknown) => void
|
|
32
|
-
clock?: ModalListClock
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
type ModalListComponent = (props: ModalListProps) => JSX.Element
|
|
36
|
-
|
|
37
|
-
type Deferred<T> = {
|
|
38
|
-
promise: Promise<T>
|
|
39
|
-
resolve(value: T): void
|
|
40
|
-
reject(error: unknown): void
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
class TestClock {
|
|
44
|
-
private time: number
|
|
45
|
-
private nextId = 1
|
|
46
|
-
private readonly intervals = new Map<
|
|
47
|
-
number,
|
|
48
|
-
{
|
|
49
|
-
delayMs: number
|
|
50
|
-
nextAt: number
|
|
51
|
-
fn: () => void
|
|
52
|
-
}
|
|
53
|
-
>()
|
|
54
|
-
readonly cleared: number[] = []
|
|
55
|
-
|
|
56
|
-
constructor(startAt = 0) {
|
|
57
|
-
this.time = startAt
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
now(): number {
|
|
61
|
-
return this.time
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
setInterval(fn: () => void, delayMs: number): number {
|
|
65
|
-
const id = this.nextId
|
|
66
|
-
this.nextId += 1
|
|
67
|
-
this.intervals.set(id, {
|
|
68
|
-
delayMs,
|
|
69
|
-
nextAt: this.time + delayMs,
|
|
70
|
-
fn,
|
|
71
|
-
})
|
|
72
|
-
return id
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
clearInterval(handle: unknown): void {
|
|
76
|
-
const id = Number(handle)
|
|
77
|
-
this.cleared.push(id)
|
|
78
|
-
this.intervals.delete(id)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
advance(delayMs: number): void {
|
|
82
|
-
const target = this.time + delayMs
|
|
83
|
-
|
|
84
|
-
while (true) {
|
|
85
|
-
let nextId: number | undefined
|
|
86
|
-
let nextAt = Number.POSITIVE_INFINITY
|
|
87
|
-
|
|
88
|
-
for (const [id, interval] of this.intervals) {
|
|
89
|
-
if (interval.nextAt < nextAt) {
|
|
90
|
-
nextAt = interval.nextAt
|
|
91
|
-
nextId = id
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (nextId === undefined || nextAt > target) {
|
|
96
|
-
break
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const interval = this.intervals.get(nextId)
|
|
100
|
-
if (!interval) {
|
|
101
|
-
break
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
this.time = interval.nextAt
|
|
105
|
-
interval.fn()
|
|
106
|
-
|
|
107
|
-
const updated = this.intervals.get(nextId)
|
|
108
|
-
if (updated) {
|
|
109
|
-
updated.nextAt += updated.delayMs
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
this.time = target
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
get activeIntervalCount(): number {
|
|
117
|
-
return this.intervals.size
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
adapter(): ModalListClock {
|
|
121
|
-
return {
|
|
122
|
-
now: () => this.now(),
|
|
123
|
-
setInterval: (fn, delayMs) => this.setInterval(fn, delayMs),
|
|
124
|
-
clearInterval: (handle) => this.clearInterval(handle),
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
async function loadModalList(): Promise<ModalListComponent> {
|
|
130
|
-
await import('@opentui/solid/runtime-plugin-support')
|
|
131
|
-
|
|
132
|
-
const module = await import('../components/modal-list')
|
|
133
|
-
const modalList =
|
|
134
|
-
Reflect.get(module, 'ModalList') ?? Reflect.get(module, 'default')
|
|
135
|
-
|
|
136
|
-
expect(typeof modalList).toBe('function')
|
|
137
|
-
|
|
138
|
-
return modalList as ModalListComponent
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function createDeferred<T>(): Deferred<T> {
|
|
142
|
-
let resolveFn: (value: T) => void = () => {}
|
|
143
|
-
let rejectFn: (error: unknown) => void = () => {}
|
|
144
|
-
const promise = new Promise<T>((resolve, reject) => {
|
|
145
|
-
resolveFn = resolve
|
|
146
|
-
rejectFn = reject
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
return {
|
|
150
|
-
promise,
|
|
151
|
-
resolve(value: T) {
|
|
152
|
-
resolveFn(value)
|
|
153
|
-
},
|
|
154
|
-
reject(error: unknown) {
|
|
155
|
-
rejectFn(error)
|
|
156
|
-
},
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function makeTask(taskId: string, overrides: Partial<TaskRow> = {}): TaskRow {
|
|
161
|
-
return {
|
|
162
|
-
taskId,
|
|
163
|
-
status: 'running',
|
|
164
|
-
agent: 'default',
|
|
165
|
-
model: 'gpt-5',
|
|
166
|
-
elapsedMs: 0,
|
|
167
|
-
toolCallCount: 0,
|
|
168
|
-
startedAt: 0,
|
|
169
|
-
...overrides,
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
type CaptureSpans = Awaited<ReturnType<typeof testRender>>['captureSpans']
|
|
174
|
-
type CapturedFrame = ReturnType<CaptureSpans>
|
|
175
|
-
|
|
176
|
-
function findLineAttributesContaining(frame: CapturedFrame, text: string) {
|
|
177
|
-
return frame.lines.find((line) =>
|
|
178
|
-
line.spans.some((span) => span.text.includes(text)),
|
|
179
|
-
)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function lineHasInverse(
|
|
183
|
-
line: CapturedFrame['lines'][number] | undefined,
|
|
184
|
-
): boolean {
|
|
185
|
-
if (!line) {
|
|
186
|
-
return false
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return line.spans.some(
|
|
190
|
-
(span) => span.text.trim().length > 0 && span.attributes !== 0,
|
|
191
|
-
)
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
async function settle(
|
|
195
|
-
renderOnce: () => Promise<void>,
|
|
196
|
-
idle: () => Promise<void>,
|
|
197
|
-
) {
|
|
198
|
-
await Promise.resolve()
|
|
199
|
-
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
200
|
-
await renderOnce()
|
|
201
|
-
await idle()
|
|
202
|
-
await renderOnce()
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
async function waitForFrame(options: {
|
|
206
|
-
renderOnce: () => Promise<void>
|
|
207
|
-
idle: () => Promise<void>
|
|
208
|
-
captureCharFrame: () => string
|
|
209
|
-
includes: string
|
|
210
|
-
attempts?: number
|
|
211
|
-
}): Promise<string> {
|
|
212
|
-
const attempts = options.attempts ?? 10
|
|
213
|
-
|
|
214
|
-
for (let index = 0; index < attempts; index += 1) {
|
|
215
|
-
await settle(options.renderOnce, options.idle)
|
|
216
|
-
const frame = options.captureCharFrame()
|
|
217
|
-
|
|
218
|
-
if (frame.includes(options.includes)) {
|
|
219
|
-
return frame
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return options.captureCharFrame()
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
describe('modal list', () => {
|
|
227
|
-
it('renders a loading state before tasksList resolves', async () => {
|
|
228
|
-
const ModalList = await loadModalList()
|
|
229
|
-
const deferred = createDeferred<TasksListResponse>()
|
|
230
|
-
let calls = 0
|
|
231
|
-
|
|
232
|
-
const { renderOnce, captureCharFrame } = await testRender(
|
|
233
|
-
() => (
|
|
234
|
-
<ModalList
|
|
235
|
-
rpc={{
|
|
236
|
-
tasksList: () => {
|
|
237
|
-
calls += 1
|
|
238
|
-
return deferred.promise
|
|
239
|
-
},
|
|
240
|
-
}}
|
|
241
|
-
onClose={() => {}}
|
|
242
|
-
/>
|
|
243
|
-
),
|
|
244
|
-
{ width: 120, height: 20, useThread: false },
|
|
245
|
-
)
|
|
246
|
-
|
|
247
|
-
await renderOnce()
|
|
248
|
-
|
|
249
|
-
const frame = captureCharFrame()
|
|
250
|
-
expect(calls).toBe(1)
|
|
251
|
-
expect(frame).toContain('Loading delegations')
|
|
252
|
-
expect(frame).toContain('Esc close')
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
it('renders an empty state after tasksList returns no tasks', async () => {
|
|
256
|
-
const ModalList = await loadModalList()
|
|
257
|
-
|
|
258
|
-
const { renderOnce, captureCharFrame, renderer } = await testRender(
|
|
259
|
-
() => (
|
|
260
|
-
<ModalList
|
|
261
|
-
rpc={{ tasksList: async () => ({ tasks: [] }) }}
|
|
262
|
-
onClose={() => {}}
|
|
263
|
-
/>
|
|
264
|
-
),
|
|
265
|
-
{ width: 120, height: 20, useThread: false },
|
|
266
|
-
)
|
|
267
|
-
|
|
268
|
-
await renderOnce()
|
|
269
|
-
|
|
270
|
-
const frame = await waitForFrame({
|
|
271
|
-
renderOnce,
|
|
272
|
-
idle: () => renderer.idle(),
|
|
273
|
-
captureCharFrame,
|
|
274
|
-
includes: '0 running · 0 recent',
|
|
275
|
-
})
|
|
276
|
-
expect(frame).toContain('0 running · 0 recent')
|
|
277
|
-
expect(frame).toContain('No Copilot delegations are running.')
|
|
278
|
-
expect(frame).toContain(
|
|
279
|
-
'Start one with the copilot_delegate tool, then reopen /copilot-status.',
|
|
280
|
-
)
|
|
281
|
-
expect(frame).toContain('Esc close')
|
|
282
|
-
})
|
|
283
|
-
|
|
284
|
-
it('reports load errors instead of rendering an inline error state', async () => {
|
|
285
|
-
const ModalList = await loadModalList()
|
|
286
|
-
const loadErrors: unknown[] = []
|
|
287
|
-
let closeCalls = 0
|
|
288
|
-
|
|
289
|
-
const { renderOnce, captureCharFrame, renderer } = await testRender(
|
|
290
|
-
() => (
|
|
291
|
-
<ModalList
|
|
292
|
-
rpc={{
|
|
293
|
-
tasksList: async () => {
|
|
294
|
-
throw new Error('rpc exploded on localhost')
|
|
295
|
-
},
|
|
296
|
-
}}
|
|
297
|
-
onClose={() => {
|
|
298
|
-
closeCalls += 1
|
|
299
|
-
}}
|
|
300
|
-
onLoadError={(error: unknown) => {
|
|
301
|
-
loadErrors.push(error)
|
|
302
|
-
}}
|
|
303
|
-
/>
|
|
304
|
-
),
|
|
305
|
-
{ width: 120, height: 20, useThread: false },
|
|
306
|
-
)
|
|
307
|
-
|
|
308
|
-
await renderOnce()
|
|
309
|
-
|
|
310
|
-
const frame = await waitForFrame({
|
|
311
|
-
renderOnce,
|
|
312
|
-
idle: () => renderer.idle(),
|
|
313
|
-
captureCharFrame,
|
|
314
|
-
includes: 'Loading delegations…',
|
|
315
|
-
})
|
|
316
|
-
expect(frame).toContain('Loading delegations…')
|
|
317
|
-
expect(frame).toContain('Esc close')
|
|
318
|
-
expect(closeCalls).toBe(0)
|
|
319
|
-
expect(loadErrors).toHaveLength(1)
|
|
320
|
-
expect(loadErrors[0]).toBeInstanceOf(Error)
|
|
321
|
-
expect((loadErrors[0] as Error).message).toBe('rpc exploded on localhost')
|
|
322
|
-
})
|
|
323
|
-
|
|
324
|
-
it('reports load errors without closing first when an alert handler is present', async () => {
|
|
325
|
-
const ModalList = await loadModalList()
|
|
326
|
-
const callOrder: string[] = []
|
|
327
|
-
|
|
328
|
-
const { renderOnce, renderer } = await testRender(
|
|
329
|
-
() => (
|
|
330
|
-
<ModalList
|
|
331
|
-
rpc={{
|
|
332
|
-
tasksList: async () => {
|
|
333
|
-
throw new Error('rpc exploded on localhost')
|
|
334
|
-
},
|
|
335
|
-
}}
|
|
336
|
-
onClose={() => {
|
|
337
|
-
callOrder.push('close')
|
|
338
|
-
}}
|
|
339
|
-
onLoadError={() => {
|
|
340
|
-
callOrder.push('error')
|
|
341
|
-
}}
|
|
342
|
-
/>
|
|
343
|
-
),
|
|
344
|
-
{ width: 120, height: 20, useThread: false },
|
|
345
|
-
)
|
|
346
|
-
|
|
347
|
-
await renderOnce()
|
|
348
|
-
await settle(renderOnce, () => renderer.idle())
|
|
349
|
-
|
|
350
|
-
expect(callOrder).toEqual(['error'])
|
|
351
|
-
})
|
|
352
|
-
|
|
353
|
-
it('renders running rows as a read-only status list', async () => {
|
|
354
|
-
const ModalList = await loadModalList()
|
|
355
|
-
const clock = new TestClock(2_000)
|
|
356
|
-
const tasks = [
|
|
357
|
-
makeTask('cpl_alpha', {
|
|
358
|
-
startedAt: 0,
|
|
359
|
-
toolCallCount: 3,
|
|
360
|
-
}),
|
|
361
|
-
makeTask('cpl_beta', {
|
|
362
|
-
agent: '',
|
|
363
|
-
model: '',
|
|
364
|
-
startedAt: 1_000,
|
|
365
|
-
toolCallCount: 1,
|
|
366
|
-
}),
|
|
367
|
-
makeTask('cpl_gamma', {
|
|
368
|
-
agent: 'reviewer',
|
|
369
|
-
model: 'claude-sonnet-4.7',
|
|
370
|
-
startedAt: 2_000,
|
|
371
|
-
toolCallCount: 5,
|
|
372
|
-
}),
|
|
373
|
-
]
|
|
374
|
-
|
|
375
|
-
const { renderOnce, captureCharFrame, captureSpans, renderer } =
|
|
376
|
-
await testRender(
|
|
377
|
-
() => (
|
|
378
|
-
<ModalList
|
|
379
|
-
rpc={{ tasksList: async () => ({ tasks }) }}
|
|
380
|
-
onClose={() => {}}
|
|
381
|
-
clock={clock.adapter()}
|
|
382
|
-
/>
|
|
383
|
-
),
|
|
384
|
-
{ width: 120, height: 20, useThread: false },
|
|
385
|
-
)
|
|
386
|
-
|
|
387
|
-
await renderOnce()
|
|
388
|
-
|
|
389
|
-
const frame = await waitForFrame({
|
|
390
|
-
renderOnce,
|
|
391
|
-
idle: () => renderer.idle(),
|
|
392
|
-
captureCharFrame,
|
|
393
|
-
includes: '3 running · 0 recent',
|
|
394
|
-
})
|
|
395
|
-
expect(frame).toContain('3 running · 0 recent')
|
|
396
|
-
expect(frame).toContain('Esc close')
|
|
397
|
-
expect(frame).not.toContain('navigate')
|
|
398
|
-
expect(frame).not.toContain('c cancel')
|
|
399
|
-
expect(frame).toContain('cpl_alpha')
|
|
400
|
-
expect(frame).toContain('cpl_beta')
|
|
401
|
-
expect(frame).toContain('cpl_gamma')
|
|
402
|
-
expect(frame).toContain('default')
|
|
403
|
-
expect(frame).toContain('reviewer')
|
|
404
|
-
expect(frame).toContain('claude-sonnet-4.7')
|
|
405
|
-
expect(frame).toContain('3 calls')
|
|
406
|
-
expect(frame).toContain('5 calls')
|
|
407
|
-
expect(frame).toContain('0s')
|
|
408
|
-
|
|
409
|
-
const spans = captureSpans()
|
|
410
|
-
const firstLine = findLineAttributesContaining(spans, 'cpl_alpha')
|
|
411
|
-
expect(firstLine).toBeDefined()
|
|
412
|
-
expect(lineHasInverse(firstLine)).toBe(false)
|
|
413
|
-
})
|
|
414
|
-
|
|
415
|
-
it('keeps cancelling tasks visible until runtime removes them', async () => {
|
|
416
|
-
const ModalList = await loadModalList()
|
|
417
|
-
|
|
418
|
-
const { renderOnce, captureCharFrame, renderer } = await testRender(
|
|
419
|
-
() => (
|
|
420
|
-
<ModalList
|
|
421
|
-
rpc={{
|
|
422
|
-
tasksList: async () => ({
|
|
423
|
-
tasks: [makeTask('cpl_cancelling', { status: 'cancelling' })],
|
|
424
|
-
}),
|
|
425
|
-
}}
|
|
426
|
-
onClose={() => {}}
|
|
427
|
-
/>
|
|
428
|
-
),
|
|
429
|
-
{ width: 120, height: 20, useThread: false },
|
|
430
|
-
)
|
|
431
|
-
|
|
432
|
-
await renderOnce()
|
|
433
|
-
|
|
434
|
-
const frame = await waitForFrame({
|
|
435
|
-
renderOnce,
|
|
436
|
-
idle: () => renderer.idle(),
|
|
437
|
-
captureCharFrame,
|
|
438
|
-
includes: 'cpl_cancelling',
|
|
439
|
-
})
|
|
440
|
-
|
|
441
|
-
expect(frame).toContain('1 running · 0 recent')
|
|
442
|
-
expect(frame).toContain('cancelling')
|
|
443
|
-
expect(frame).toContain('cpl_cancelling')
|
|
444
|
-
})
|
|
445
|
-
|
|
446
|
-
it('updates elapsed time from an injected clock without waiting on wall time', async () => {
|
|
447
|
-
const ModalList = await loadModalList()
|
|
448
|
-
const clock = new TestClock(0)
|
|
449
|
-
|
|
450
|
-
const { renderOnce, captureCharFrame, renderer } = await testRender(
|
|
451
|
-
() => (
|
|
452
|
-
<ModalList
|
|
453
|
-
rpc={{
|
|
454
|
-
tasksList: async () => ({
|
|
455
|
-
tasks: [
|
|
456
|
-
makeTask('cpl_elapsed', {
|
|
457
|
-
startedAt: 0,
|
|
458
|
-
}),
|
|
459
|
-
],
|
|
460
|
-
}),
|
|
461
|
-
}}
|
|
462
|
-
onClose={() => {}}
|
|
463
|
-
clock={clock.adapter()}
|
|
464
|
-
/>
|
|
465
|
-
),
|
|
466
|
-
{ width: 120, height: 20, useThread: false },
|
|
467
|
-
)
|
|
468
|
-
|
|
469
|
-
await renderOnce()
|
|
470
|
-
const readyFrame = await waitForFrame({
|
|
471
|
-
renderOnce,
|
|
472
|
-
idle: () => renderer.idle(),
|
|
473
|
-
captureCharFrame,
|
|
474
|
-
includes: '0s',
|
|
475
|
-
})
|
|
476
|
-
expect(readyFrame).toContain('0s')
|
|
477
|
-
|
|
478
|
-
clock.advance(1_100)
|
|
479
|
-
await renderOnce()
|
|
480
|
-
|
|
481
|
-
expect(captureCharFrame()).toContain('1s')
|
|
482
|
-
})
|
|
483
|
-
|
|
484
|
-
it('clears its refresh interval on teardown', async () => {
|
|
485
|
-
const ModalList = await loadModalList()
|
|
486
|
-
const clock = new TestClock(0)
|
|
487
|
-
|
|
488
|
-
const { renderer, renderOnce } = await testRender(
|
|
489
|
-
() => (
|
|
490
|
-
<ModalList
|
|
491
|
-
rpc={{
|
|
492
|
-
tasksList: async () => ({
|
|
493
|
-
tasks: [makeTask('cpl_cleanup')],
|
|
494
|
-
}),
|
|
495
|
-
}}
|
|
496
|
-
onClose={() => {}}
|
|
497
|
-
clock={clock.adapter()}
|
|
498
|
-
/>
|
|
499
|
-
),
|
|
500
|
-
{ width: 120, height: 20, useThread: false },
|
|
501
|
-
)
|
|
502
|
-
|
|
503
|
-
await renderOnce()
|
|
504
|
-
await waitForFrame({
|
|
505
|
-
renderOnce,
|
|
506
|
-
idle: () => renderer.idle(),
|
|
507
|
-
captureCharFrame: () => String(clock.activeIntervalCount),
|
|
508
|
-
includes: '1',
|
|
509
|
-
})
|
|
510
|
-
|
|
511
|
-
expect(clock.activeIntervalCount).toBe(1)
|
|
512
|
-
|
|
513
|
-
renderer.destroy()
|
|
514
|
-
|
|
515
|
-
expect(clock.activeIntervalCount).toBe(0)
|
|
516
|
-
expect(clock.cleared).toHaveLength(1)
|
|
517
|
-
})
|
|
518
|
-
})
|