@startsimpli/integrations 0.2.187 → 0.2.188
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/package.json +6 -6
- package/src/__tests__/connection-reconnect.test.tsx +69 -0
- package/src/__tests__/converse-brain.test.ts +44 -0
- package/src/__tests__/converse-meeting.test.ts +118 -0
- package/src/__tests__/converse-page.test.tsx +150 -83
- package/src/__tests__/converse.test.ts +32 -0
- package/src/__tests__/corpus-tracker.test.tsx +37 -35
- package/src/__tests__/plan-shell.test.tsx +14 -11
- package/src/__tests__/possibly-done-extract.test.ts +90 -0
- package/src/__tests__/possibly-done-ui.test.tsx +80 -0
- package/src/components/pages/ConversePage.tsx +128 -83
- package/src/components/pages/TaskDetailPage.tsx +22 -0
- package/src/components/pages/TrackerPage.tsx +15 -141
- package/src/components/pages/connections/ConnectionCard.tsx +20 -0
- package/src/components/pages/connections/bound-api.ts +2 -0
- package/src/components/pages/converse/Thread.tsx +46 -0
- package/src/components/pages/converse/browserIO.ts +15 -5
- package/src/components/pages/home/CompactItemRow.tsx +4 -1
- package/src/components/pages/plan/TalkPage.tsx +8 -29
- package/src/components/pages/tracker/PossiblyDone.tsx +49 -0
- package/src/corpus/client.ts +2 -0
- package/src/corpus/commitments.ts +27 -6
- package/src/corpus/converse/brain.ts +24 -16
- package/src/corpus/converse/handle.ts +24 -2
- package/src/corpus/converse/index.ts +2 -1
- package/src/corpus/converse/meeting.ts +70 -21
- package/src/corpus/converse/route.ts +4 -3
- package/src/corpus/converse/sources.ts +17 -0
- package/src/corpus/converse/types.ts +19 -0
- package/src/corpus/entities.ts +4 -0
- package/src/corpus/nav-copy.ts +3 -3
- package/src/corpus/possibly-done.ts +59 -0
- package/src/corpus/types.ts +17 -1
- package/src/native/converse/io.ts +2 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* source, a run that closed something and did not say why.
|
|
9
9
|
*/
|
|
10
10
|
import * as React from 'react';
|
|
11
|
-
import { render, screen, within } from '@testing-library/react';
|
|
11
|
+
import { render, screen, waitFor, within } from '@testing-library/react';
|
|
12
12
|
import userEvent from '@testing-library/user-event';
|
|
13
13
|
import { describe, expect, it, vi } from 'vitest';
|
|
14
14
|
|
|
@@ -285,40 +285,41 @@ describe('TrackerPage — running the extraction', () => {
|
|
|
285
285
|
provider: { provider: 'anthropic', model: 'claude-sonnet-4-6', live: true },
|
|
286
286
|
};
|
|
287
287
|
|
|
288
|
-
it('
|
|
288
|
+
it('leaves no summary block behind after a run (Quinn: the meeting-import summary is useless)', async () => {
|
|
289
289
|
const extract = vi.fn(async () => RESULT);
|
|
290
290
|
render(<TrackerPage api={makeApi({ extract })} scope={SCOPE} now={NOW} />);
|
|
291
291
|
await screen.findByText('Chase the inventor for comments on 2148');
|
|
292
292
|
await userEvent.click(screen.getByRole('button', { name: 'Pull from meetings' }));
|
|
293
293
|
|
|
294
|
-
expect(extract).toHaveBeenCalledWith({ scope: SCOPE });
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
expect(screen.
|
|
298
|
-
expect(screen.
|
|
294
|
+
await waitFor(() => expect(extract).toHaveBeenCalledWith({ scope: SCOPE }));
|
|
295
|
+
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
296
|
+
expect(screen.queryByText(/Read 16 meetings/)).toBeNull();
|
|
297
|
+
expect(screen.queryByText(/came from the meetings/)).toBeNull();
|
|
298
|
+
expect(screen.queryByText(/anthropic · claude-sonnet-4-6/)).toBeNull();
|
|
299
299
|
});
|
|
300
300
|
|
|
301
|
-
it('
|
|
302
|
-
|
|
301
|
+
it('does not list meeting statements that looked like they closed something', async () => {
|
|
302
|
+
const extract = vi.fn(async () => RESULT);
|
|
303
|
+
render(<TrackerPage api={makeApi({ extract })} scope={SCOPE} now={NOW} />);
|
|
303
304
|
await screen.findByText('Chase the inventor for comments on 2148');
|
|
304
305
|
await userEvent.click(screen.getByRole('button', { name: 'Pull from meetings' }));
|
|
305
306
|
|
|
306
|
-
|
|
307
|
-
|
|
307
|
+
await waitFor(() => expect(extract).toHaveBeenCalled());
|
|
308
|
+
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
309
|
+
expect(screen.queryByText(/looked like they closed something/)).toBeNull();
|
|
310
|
+
expect(screen.queryByText(/Nothing was closed automatically/)).toBeNull();
|
|
311
|
+
expect(screen.queryByText(/2148 came back from the inventor/)).toBeNull();
|
|
308
312
|
});
|
|
309
313
|
|
|
310
|
-
it('
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
api={makeApi({ extract: async () => ({ ...RESULT, droppedOutOfScope: 3 }) })}
|
|
314
|
-
scope={SCOPE}
|
|
315
|
-
now={NOW}
|
|
316
|
-
/>,
|
|
317
|
-
);
|
|
314
|
+
it('shows no run summary even when the data API returned out-of-scope records', async () => {
|
|
315
|
+
const extract = vi.fn(async () => ({ ...RESULT, droppedOutOfScope: 3 }));
|
|
316
|
+
render(<TrackerPage api={makeApi({ extract })} scope={SCOPE} now={NOW} />);
|
|
318
317
|
await screen.findByText('Chase the inventor for comments on 2148');
|
|
319
318
|
await userEvent.click(screen.getByRole('button', { name: 'Pull from meetings' }));
|
|
320
319
|
|
|
321
|
-
|
|
320
|
+
await waitFor(() => expect(extract).toHaveBeenCalled());
|
|
321
|
+
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
322
|
+
expect(screen.queryByText(/from another\s+workspace were returned/)).toBeNull();
|
|
322
323
|
});
|
|
323
324
|
|
|
324
325
|
it('hides the control entirely on a read-only deployment', async () => {
|
|
@@ -347,19 +348,17 @@ describe('TrackerPage — the run reports its own precision work', () => {
|
|
|
347
348
|
return screen;
|
|
348
349
|
}
|
|
349
350
|
|
|
350
|
-
it('
|
|
351
|
-
// Measured over the sixteen real meetings, two thirds of what the model
|
|
352
|
-
// proposes does not survive the check. Hiding that would make the model look
|
|
353
|
-
// better than it is and the list less arguable than it should be.
|
|
351
|
+
it('does not report how many proposed items were dropped', async () => {
|
|
354
352
|
await runWith(BASE);
|
|
355
|
-
|
|
356
|
-
expect(screen.
|
|
357
|
-
expect(screen.
|
|
353
|
+
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
354
|
+
expect(screen.queryByText(/proposed and dropped/)).toBeNull();
|
|
355
|
+
expect(screen.queryByText(/quoted something the record does not say/)).toBeNull();
|
|
358
356
|
});
|
|
359
357
|
|
|
360
|
-
it('
|
|
358
|
+
it('does not report that the check did not run', async () => {
|
|
361
359
|
await runWith({ ...BASE, verified: false, unconfirmed: 0, ungrounded: 0 });
|
|
362
|
-
|
|
360
|
+
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
361
|
+
expect(screen.queryByText(/were NOT checked against the meetings/)).toBeNull();
|
|
363
362
|
});
|
|
364
363
|
|
|
365
364
|
it('stays quiet when the model contributed nothing at all', async () => {
|
|
@@ -465,7 +464,7 @@ describe('TrackerPage — watching a queued sweep', () => {
|
|
|
465
464
|
expect(await screen.findByText(/9 of 17 meetings/)).toBeInTheDocument();
|
|
466
465
|
});
|
|
467
466
|
|
|
468
|
-
it('
|
|
467
|
+
it('shows nothing once a sweep has finished, even when the model did not answer', async () => {
|
|
469
468
|
// The lie this bead exists to kill: `fromModel: 0` with no explanation reads
|
|
470
469
|
// exactly like "the model had nothing to add", and that is how a week of
|
|
471
470
|
// rules-only runs got reported as model runs.
|
|
@@ -488,9 +487,11 @@ describe('TrackerPage — watching a queued sweep', () => {
|
|
|
488
487
|
now={NOW}
|
|
489
488
|
/>,
|
|
490
489
|
);
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
expect(screen.
|
|
490
|
+
await screen.findByText('Chase the inventor for comments on 2148');
|
|
491
|
+
await new Promise((resolve) => setTimeout(resolve, 120));
|
|
492
|
+
expect(screen.queryByText(/the model did not answer/i)).toBeNull();
|
|
493
|
+
expect(screen.queryByText(/timed out/i)).toBeNull();
|
|
494
|
+
expect(screen.queryByText(/12 meetings/)).toBeNull();
|
|
494
495
|
});
|
|
495
496
|
|
|
496
497
|
it('offers to resume a sweep whose driver went away, rather than spinning', async () => {
|
|
@@ -609,8 +610,9 @@ describe('TrackerPage — watching a queued sweep', () => {
|
|
|
609
610
|
}));
|
|
610
611
|
render(<TrackerPage api={makeApi({ extract })} scope={SCOPE} now={NOW} />);
|
|
611
612
|
await userEvent.click(await screen.findByRole('button', { name: /Pull from meetings/i }));
|
|
612
|
-
expect(extract).toHaveBeenCalled();
|
|
613
|
-
|
|
613
|
+
await waitFor(() => expect(extract).toHaveBeenCalled());
|
|
614
|
+
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
615
|
+
expect(screen.queryByText(/Read 1 meeting/)).toBeNull();
|
|
614
616
|
});
|
|
615
617
|
});
|
|
616
618
|
|
|
@@ -33,19 +33,26 @@ function trackerApi(onQuery: (q: CommitmentQuery) => void = () => undefined, cre
|
|
|
33
33
|
describe('copy', () => {
|
|
34
34
|
it('gives every tab and sub-tab one plain line', () => {
|
|
35
35
|
expect(TAB_COPY.today.subtitle).toBe('Your morning brief and what is due soon.');
|
|
36
|
-
expect(TAB_COPY.talk.subtitle).toBe('Talk or type
|
|
36
|
+
expect(TAB_COPY.talk.subtitle).toBe('Talk or type: plans, questions, notes. Say "parse that note" when you are done.');
|
|
37
37
|
expect(TAB_COPY.plan.subtitle).toBe('Everything you owe, and what you are aiming for.');
|
|
38
|
-
expect(TAB_COPY.more.subtitle).toBe('Library, Decisions, Connections
|
|
38
|
+
expect(TAB_COPY.more.subtitle).toBe('Library, Decisions, Connections.');
|
|
39
39
|
expect(PLAN_TABS.map((t) => [t.label, t.subtitle])).toEqual([
|
|
40
40
|
['To-dos', 'The one list of everything you owe: add, tick off, filter.'],
|
|
41
41
|
['Timeline', 'What was created, finished and overdue over time.'],
|
|
42
42
|
['Projects', 'Your projects and goals, with progress. Open one to see its to-dos.'],
|
|
43
43
|
]);
|
|
44
|
-
expect(MORE_ENTRIES.map((e) => e.label)).toEqual(['Library', 'Decisions', 'Connections'
|
|
44
|
+
expect(MORE_ENTRIES.map((e) => e.label)).toEqual(['Library', 'Decisions', 'Connections']);
|
|
45
45
|
for (const line of [...Object.values(TAB_COPY), ...PLAN_TABS, ...MORE_ENTRIES, ...TALK_MODES]) expect(line.subtitle).toMatch(/\.$/);
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
+
describe('More has no Admin', () => {
|
|
50
|
+
it('lists no admin entry or word: that lives in the Foundry app', () => {
|
|
51
|
+
expect(MORE_ENTRIES.some((e) => e.key === 'admin' || /admin/i.test(e.label))).toBe(false);
|
|
52
|
+
expect(TAB_COPY.more.subtitle).not.toMatch(/admin/i);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
49
56
|
describe('the to-do list as the Plan sub-tab', () => {
|
|
50
57
|
it('can leave the timeline to its own sub-tab', async () => {
|
|
51
58
|
const api = trackerApi();
|
|
@@ -108,16 +115,12 @@ describe('Projects', () => {
|
|
|
108
115
|
});
|
|
109
116
|
|
|
110
117
|
describe('Talk', () => {
|
|
111
|
-
it('
|
|
112
|
-
|
|
113
|
-
const { rerender } = render(<TalkPage mode="talk" onModeChange={onModeChange} talk={<p>talk body</p>} ask={<p>ask body</p>} />);
|
|
118
|
+
it('is one screen: the subtitle and the screen, no mode toggle', () => {
|
|
119
|
+
render(<TalkPage talk={<p>talk body</p>} />);
|
|
114
120
|
expect(screen.getByText('talk body')).toBeTruthy();
|
|
115
121
|
expect(screen.getByTestId('talk-mode-subtitle').textContent).toBe(TAB_COPY.talk.subtitle);
|
|
116
|
-
|
|
117
|
-
expect(
|
|
118
|
-
rerender(<TalkPage mode="ask" onModeChange={onModeChange} talk={<p>talk body</p>} ask={<p>ask body</p>} />);
|
|
119
|
-
expect(screen.getByText('ask body')).toBeTruthy();
|
|
120
|
-
expect(screen.queryByText('talk body')).toBeNull();
|
|
122
|
+
expect(screen.queryByRole('tablist')).toBeNull();
|
|
123
|
+
expect(screen.queryByRole('tab')).toBeNull();
|
|
121
124
|
});
|
|
122
125
|
});
|
|
123
126
|
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A meeting statement that plausibly closes a to-do is kept ON that to-do
|
|
3
|
+
* (data.possibly_done); a statement that matched nothing is dropped; a dismissed
|
|
4
|
+
* one is not raised again by the next sweep.
|
|
5
|
+
*/
|
|
6
|
+
import { describe, expect, it } from 'vitest';
|
|
7
|
+
|
|
8
|
+
import { applyResolutions, mergeDrafts, reconcile } from '../corpus/commitments';
|
|
9
|
+
import { commitmentToEntity, toCommitment, type TenantEntity } from '../corpus/entities';
|
|
10
|
+
import { dismissCandidate, writePossiblyDone } from '../corpus/possibly-done';
|
|
11
|
+
import type { Commitment, CommitmentDraft, SourceDocument } from '../corpus/types';
|
|
12
|
+
|
|
13
|
+
const SCOPE = { orgId: 'o' } as never;
|
|
14
|
+
const meeting = (id: string, date: string, title = `Standup ${id}`) =>
|
|
15
|
+
({ id, title, body: '', occurredAt: `${date}T00:00:00Z`, participants: [] }) as unknown as SourceDocument;
|
|
16
|
+
const draft = (documentId: string, title: string): CommitmentDraft => ({
|
|
17
|
+
documentId, originKey: `${documentId}:${title.slice(0, 20)}`, subtype: 'action', title, detail: '',
|
|
18
|
+
status: 'open', quote: title,
|
|
19
|
+
} as unknown as CommitmentDraft);
|
|
20
|
+
|
|
21
|
+
function openItems(): Commitment[] {
|
|
22
|
+
return reconcile([], mergeDrafts([
|
|
23
|
+
draft('m1', 'Chase Dr. Zhang for comments on 2148'),
|
|
24
|
+
draft('m1', 'Book the venue for the offsite'),
|
|
25
|
+
]), { scope: SCOPE, documents: [meeting('m1', '2026-08-01')] }).commitments;
|
|
26
|
+
}
|
|
27
|
+
// Shares "zhang"/"comments" with the item but is too weak to close it.
|
|
28
|
+
const weak = {
|
|
29
|
+
documentId: 'm2', subject: '2148', outcome: 'done' as const,
|
|
30
|
+
statement: 'Zhang comments probably landed', quote: 'I think Zhang’s comments landed last week',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
describe('possibly done: stored on the matched to-do', () => {
|
|
34
|
+
it('writes the candidate on the matched commitment and does not close it', () => {
|
|
35
|
+
const r = applyResolutions(openItems(), [weak], { documents: [meeting('m2', '2026-08-06', 'Weekly sync')] });
|
|
36
|
+
const chase = r.commitments.find((c) => c.title.startsWith('Chase'))!;
|
|
37
|
+
expect(chase.status).toBe('open');
|
|
38
|
+
expect(chase.possiblyDone).toEqual([{
|
|
39
|
+
quote: weak.quote, documentId: 'm2', documentTitle: 'Weekly sync', at: '2026-08-06T00:00:00.000Z', state: 'pending',
|
|
40
|
+
}]);
|
|
41
|
+
expect(r.touched).toContain(chase.externalId);
|
|
42
|
+
// the other item is untouched
|
|
43
|
+
expect(r.commitments.find((c) => c.title.startsWith('Book'))!.possiblyDone).toBeUndefined();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('drops a statement that matched no item: nothing is stored anywhere', () => {
|
|
47
|
+
const r = applyResolutions(openItems(), [
|
|
48
|
+
{ documentId: 'm2', subject: 'budget', statement: 'The hiring plan is finished', quote: 'hiring plan finished', outcome: 'done' },
|
|
49
|
+
], { documents: [meeting('m2', '2026-08-06')] });
|
|
50
|
+
expect(r.commitments.every((c) => !c.possiblyDone)).toBe(true);
|
|
51
|
+
expect(r.touched).toEqual([]);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('drops a statement that only shares one stem with an item (a cancelled trip is not the offsite)', () => {
|
|
55
|
+
const items = reconcile([], mergeDrafts([draft('m1', 'Plan the Q1 offsite')]), { scope: SCOPE, documents: [meeting('m1', '2026-08-01')] }).commitments;
|
|
56
|
+
const r = applyResolutions(items, [
|
|
57
|
+
{ documentId: 'm2', subject: 'Berlin trip', outcome: 'dropped', statement: 'The Berlin trip planning was cancelled and is no longer happening.', quote: 'Berlin trip planning was cancelled' },
|
|
58
|
+
], { documents: [meeting('m2', '2026-08-06')] });
|
|
59
|
+
expect(r.commitments[0].possiblyDone).toBeUndefined();
|
|
60
|
+
expect(r.commitments[0].status).toBe('open');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('survives the tenant round trip (snake_case write, camelCased read)', () => {
|
|
64
|
+
const r = applyResolutions(openItems(), [weak], { documents: [meeting('m2', '2026-08-06', 'Weekly sync')] });
|
|
65
|
+
const chase = r.commitments.find((c) => c.possiblyDone)!;
|
|
66
|
+
const wire = commitmentToEntity(chase);
|
|
67
|
+
expect(wire.data.possibly_done).toEqual([expect.objectContaining({ document_id: 'm2', document_title: 'Weekly sync', state: 'pending' })]);
|
|
68
|
+
const camel = { id: '1', external_id: chase.externalId, name: 'x', entity_type: 'commitment', version: 1,
|
|
69
|
+
data: { ...wire.data, possiblyDone: (wire.data.possibly_done as Array<Record<string, unknown>>).map((e) => ({
|
|
70
|
+
documentId: e.document_id, documentTitle: e.document_title, quote: e.quote, at: e.at, state: e.state })), possibly_done: undefined } };
|
|
71
|
+
expect(toCommitment(camel as unknown as TenantEntity, SCOPE).possiblyDone).toEqual(chase.possiblyDone);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('a dismissed statement is not re-added by a second sweep, even reworded', () => {
|
|
75
|
+
const first = applyResolutions(openItems(), [weak], { documents: [meeting('m2', '2026-08-06')] }).commitments;
|
|
76
|
+
const dismissed = first.map((c) => (c.possiblyDone ? { ...c, possiblyDone: dismissCandidate(c.possiblyDone, 'm2') } : c));
|
|
77
|
+
const second = applyResolutions(dismissed, [{ ...weak, quote: 'Zhang comments came back, I believe' }], { documents: [meeting('m2', '2026-08-06')] });
|
|
78
|
+
const chase = second.commitments.find((c) => c.possiblyDone)!;
|
|
79
|
+
expect(chase.possiblyDone).toHaveLength(1);
|
|
80
|
+
expect(chase.possiblyDone![0].state).toBe('dismissed');
|
|
81
|
+
expect(second.touched).toEqual([]);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('keeps every candidate: no cap on how many a row can hold', () => {
|
|
85
|
+
const many = Array.from({ length: 25 }, (_, i) => ({
|
|
86
|
+
quote: `q${i}`, documentId: `d${i}`, documentTitle: `Meeting ${i}`, at: null, state: 'pending' as const,
|
|
87
|
+
}));
|
|
88
|
+
expect(writePossiblyDone(many)).toHaveLength(25);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** The "Possibly done" note on the to-do row and detail: two buttons, nothing automatic. */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { render, screen, waitFor, within } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { TrackerPage } from '../components/pages/TrackerPage';
|
|
8
|
+
import { TaskDetailPage } from '../components/pages/TaskDetailPage';
|
|
9
|
+
import type { Commitment, CommitmentTrackerApi } from '../corpus/types';
|
|
10
|
+
|
|
11
|
+
const NOW = Date.parse('2026-08-10T12:00:00Z');
|
|
12
|
+
const SCOPE = { orgId: 'tandem' };
|
|
13
|
+
|
|
14
|
+
const item = (externalId: string, title: string, extra: Partial<Commitment> = {}): Commitment => ({
|
|
15
|
+
id: externalId, externalId, dedupeKey: externalId, subtype: 'action', title, detail: '', status: 'open',
|
|
16
|
+
subjectKey: '', actionKey: '', mentions: [], firstSeenAt: '2026-08-01T00:00:00Z', lastSeenAt: '2026-08-01T00:00:00Z',
|
|
17
|
+
extractorVersion: 'x', source: 'granola', sourceLabel: 'Granola', scope: SCOPE, ...extra,
|
|
18
|
+
});
|
|
19
|
+
const candidate = { quote: 'Zhang’s comments landed', documentId: 'm2', documentTitle: 'Weekly sync', at: '2026-08-06T00:00:00.000Z', state: 'pending' as const };
|
|
20
|
+
|
|
21
|
+
function statefulApi(rows: Commitment[]) {
|
|
22
|
+
const updateCommitment = vi.fn(async (it: Commitment, patch: object) => {
|
|
23
|
+
const i = rows.findIndex((r) => r.externalId === it.externalId);
|
|
24
|
+
rows[i] = { ...rows[i], ...patch } as Commitment;
|
|
25
|
+
return rows[i];
|
|
26
|
+
});
|
|
27
|
+
const api = {
|
|
28
|
+
listCommitments: vi.fn(async () => ({ count: rows.length, next: null, previous: null, results: [...rows], appliedFilters: [] })),
|
|
29
|
+
updateCommitment,
|
|
30
|
+
} as unknown as CommitmentTrackerApi;
|
|
31
|
+
return { api, updateCommitment };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
describe('Possibly done on the tracker row', () => {
|
|
35
|
+
it('shows the statement with its meeting and date, and Mark done closes the to-do', async () => {
|
|
36
|
+
const rows = [item('commit:a', 'Chase Zhang', { possiblyDone: [candidate] }), item('commit:b', 'Book the venue')];
|
|
37
|
+
const { api, updateCommitment } = statefulApi(rows);
|
|
38
|
+
render(<TrackerPage api={api} scope={SCOPE} now={NOW} />);
|
|
39
|
+
const note = await screen.findByTestId('possibly-done');
|
|
40
|
+
expect(note).toHaveTextContent(/Possibly done:\s*“Zhang’s comments landed”\s*\(Weekly sync, .*2026.*\)/);
|
|
41
|
+
expect(screen.getAllByTestId('possibly-done')).toHaveLength(1); // no note on the item without a candidate
|
|
42
|
+
await userEvent.click(within(note).getByRole('button', { name: 'Mark done' }));
|
|
43
|
+
await waitFor(() => expect(updateCommitment).toHaveBeenCalledWith(
|
|
44
|
+
expect.objectContaining({ externalId: 'commit:a' }), expect.objectContaining({ status: 'done' })));
|
|
45
|
+
await waitFor(() => expect(screen.queryByTestId('possibly-done')).toBeNull());
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('Not done persists a dismissal, leaves the to-do open, and the note stays gone', async () => {
|
|
49
|
+
const rows = [item('commit:a', 'Chase Zhang', { possiblyDone: [candidate] })];
|
|
50
|
+
const { api, updateCommitment } = statefulApi(rows);
|
|
51
|
+
render(<TrackerPage api={api} scope={SCOPE} now={NOW} />);
|
|
52
|
+
await userEvent.click(within(await screen.findByTestId('possibly-done')).getByRole('button', { name: 'Not done' }));
|
|
53
|
+
await waitFor(() => expect(updateCommitment).toHaveBeenCalledWith(
|
|
54
|
+
expect.objectContaining({ externalId: 'commit:a' }),
|
|
55
|
+
{ possiblyDone: [{ ...candidate, state: 'dismissed' }] }));
|
|
56
|
+
await waitFor(() => expect(screen.queryByTestId('possibly-done')).toBeNull());
|
|
57
|
+
expect(rows[0].status).toBe('open');
|
|
58
|
+
expect(screen.getByText('Chase Zhang')).toBeInTheDocument();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('has no page-level block or count', async () => {
|
|
62
|
+
const { api } = statefulApi([item('commit:a', 'Chase Zhang', { possiblyDone: [candidate] })]);
|
|
63
|
+
render(<TrackerPage api={api} scope={SCOPE} now={NOW} />);
|
|
64
|
+
await screen.findByTestId('possibly-done');
|
|
65
|
+
expect(screen.queryByText(/need(s)? review|looked like they closed/i)).toBeNull();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe('Possibly done on the to-do detail', () => {
|
|
70
|
+
it('offers the same two buttons', async () => {
|
|
71
|
+
const rows = [item('commit:a', 'Chase Zhang', { possiblyDone: [candidate] })];
|
|
72
|
+
const { api, updateCommitment } = statefulApi(rows);
|
|
73
|
+
render(<TaskDetailPage api={api as never} scope={SCOPE as never} itemId="commit:a" />);
|
|
74
|
+
const note = await screen.findByTestId('possibly-done');
|
|
75
|
+
await userEvent.click(within(note).getByRole('button', { name: 'Not done' }));
|
|
76
|
+
await waitFor(() => expect(updateCommitment).toHaveBeenCalledWith(
|
|
77
|
+
expect.anything(), { possiblyDone: [{ ...candidate, state: 'dismissed' }] }));
|
|
78
|
+
await waitFor(() => expect(screen.queryByTestId('possibly-done')).toBeNull());
|
|
79
|
+
});
|
|
80
|
+
});
|