@startsimpli/integrations 0.2.201 → 0.2.203
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__/briefing-markdown.test.ts +64 -0
- package/src/__tests__/converse-cards.test.ts +53 -0
- package/src/__tests__/converse-page.test.tsx +148 -37
- package/src/__tests__/converse-roci.test.ts +22 -0
- package/src/__tests__/converse-structure.test.ts +27 -0
- package/src/__tests__/converse-view.test.ts +46 -0
- package/src/__tests__/corpus-tracker.test.tsx +32 -176
- package/src/__tests__/data-table-logic.test.ts +75 -0
- package/src/__tests__/data-table.test.tsx +133 -0
- package/src/__tests__/home-brief.test.tsx +25 -40
- package/src/__tests__/library-call-shape.test.tsx +164 -0
- package/src/__tests__/load-error.test.tsx +1 -1
- package/src/__tests__/mini-markdown.test.tsx +24 -0
- package/src/__tests__/overview-page.test.tsx +36 -6
- package/src/__tests__/plan-shell.test.tsx +6 -4
- package/src/__tests__/timeline-events.test.ts +65 -0
- package/src/__tests__/timeline-table.test.tsx +66 -0
- package/src/__tests__/todo-table-model.test.ts +75 -0
- package/src/__tests__/todo-table.test.tsx +202 -0
- package/src/__tests__/tracker-timeline-component.test.tsx +4 -4
- package/src/__tests__/tracker-timeline-reader.test.ts +1 -1
- package/src/comms/__tests__/app-sends-page.test.tsx +69 -0
- package/src/comms/api/comms.ts +23 -0
- package/src/comms/components/ResultsPanel.tsx +2 -2
- package/src/comms/components/SendLog.tsx +20 -8
- package/src/comms/components/index.ts +1 -0
- package/src/comms/components/pages/AppSendsPage.tsx +58 -0
- package/src/comms/hooks/index.ts +8 -3
- package/src/components/FolderTree.tsx +12 -3
- package/src/components/index.ts +2 -1
- package/src/components/pages/ConversePage.tsx +114 -105
- package/src/components/pages/LibraryPage.tsx +63 -24
- package/src/components/pages/TrackerPage.tsx +170 -474
- package/src/components/pages/converse/CardView.tsx +72 -0
- package/src/components/pages/converse/SettingsMenu.tsx +37 -0
- package/src/components/pages/converse/Thread.tsx +48 -33
- package/src/components/pages/converse/useNeedsYou.ts +60 -0
- package/src/components/pages/home/BriefCard.tsx +16 -7
- package/src/components/pages/home/HomeBriefPage.tsx +6 -91
- package/src/components/pages/home/MiniMarkdown.tsx +51 -0
- package/src/components/pages/home/{DueSoonLine.tsx → dueSoonText.ts} +2 -11
- package/src/components/pages/home/index.ts +1 -1
- package/src/components/pages/overview/OverviewPage.tsx +46 -83
- package/src/components/pages/plan/TalkPage.tsx +5 -14
- package/src/components/pages/plan/TimelinePage.tsx +4 -2
- package/src/components/pages/tracker/SweepPanel.tsx +108 -0
- package/src/components/pages/tracker/TimelineTable.tsx +70 -0
- package/src/components/pages/tracker/TrackerTimeline.tsx +32 -15
- package/src/components/table/DataTable.tsx +92 -0
- package/src/components/table/RowMenu.tsx +35 -0
- package/src/components/table/TablePagination.tsx +63 -0
- package/src/components/table/TableToolbar.tsx +56 -0
- package/src/components/table/TodoTable.tsx +142 -0
- package/src/components/table/index.ts +10 -0
- package/src/components/table/table-logic.ts +60 -0
- package/src/components/table/todo-model.ts +93 -0
- package/src/corpus/briefing/generate-weekly.ts +4 -0
- package/src/corpus/briefing/generate.ts +4 -0
- package/src/corpus/briefing/index.ts +1 -0
- package/src/corpus/briefing/markdown.ts +71 -0
- package/src/corpus/client.ts +38 -146
- package/src/corpus/converse/cards.ts +69 -0
- package/src/corpus/converse/index.ts +6 -0
- package/src/corpus/converse/roci.ts +13 -0
- package/src/corpus/converse/structure.ts +39 -0
- package/src/corpus/converse/view.ts +34 -0
- package/src/corpus/index.ts +2 -0
- package/src/corpus/participants.ts +220 -0
- package/src/corpus/timeline-events.ts +83 -0
- package/src/corpus/tracker-sort.ts +9 -3
- package/src/corpus/tracker-timeline-client.ts +2 -0
- package/src/corpus/tracker-timeline.ts +4 -0
- package/src/corpus/types.ts +32 -5
- package/src/native/app/__tests__/plan-talk-registry.test.tsx +2 -1
- package/src/native/converse/ConverseScreen.tsx +3 -5
- package/src/native/home/HomeScreen.tsx +1 -1
- package/src/native/home/tab.tsx +1 -2
- package/src/native/plan/PlanTab.tsx +1 -2
- package/src/native/plan/__tests__/plan-tab.test.tsx +5 -5
- package/src/native/talk/TalkTab.tsx +1 -1
- package/src/native/talk/__tests__/talk-tab.test.tsx +1 -1
- package/src/__tests__/home-needs-your-call.test.tsx +0 -65
- package/src/components/pages/tracker/TrackerBoard.tsx +0 -45
- package/src/components/pages/tracker/TrackerToolbar.tsx +0 -44
|
@@ -150,7 +150,7 @@ describe('TrackerPage — it must not loop', () => {
|
|
|
150
150
|
render(<TrackerPage api={api} scope={SCOPE} now={NOW} />);
|
|
151
151
|
await screen.findByText('Chase the inventor for comments on 2148');
|
|
152
152
|
expect(calls).toBe(1);
|
|
153
|
-
await userEvent.click(screen.getAllByRole('
|
|
153
|
+
await userEvent.click(screen.getAllByRole('checkbox', { name: /^Mark done:/ })[0]);
|
|
154
154
|
await new Promise((resolve) => setTimeout(resolve, 150));
|
|
155
155
|
expect(updated).toHaveLength(1);
|
|
156
156
|
expect(calls).toBe(2);
|
|
@@ -173,16 +173,15 @@ describe('TrackerPage — what is outstanding', () => {
|
|
|
173
173
|
await screen.findByText('Chase the inventor for comments on 2148');
|
|
174
174
|
|
|
175
175
|
expect(queries[0].status).toEqual(['open', 'in_progress', 'blocked']);
|
|
176
|
-
expect(queries[0].pageSize).toBe(
|
|
176
|
+
expect(queries[0].pageSize).toBe(25);
|
|
177
|
+
expect(queries[0].subtype).toEqual(['action', 'requirement']);
|
|
177
178
|
});
|
|
178
179
|
|
|
179
180
|
it('says so when the data API does not honour the filters', async () => {
|
|
180
181
|
render(<TrackerPage api={makeApi()} scope={SCOPE} now={NOW} />);
|
|
181
182
|
// The Library's `appliedFilters` contract, owed here about status — a
|
|
182
183
|
// status filter that silently does nothing breaks the screen's only claim.
|
|
183
|
-
|
|
184
|
-
expect(await screen.findByText('1 warning')).toBeInTheDocument();
|
|
185
|
-
expect(screen.getByText(/did not filter by .*status/i)).toBeInTheDocument();
|
|
184
|
+
expect(await screen.findByText(/did not filter by .*status/i)).toBeInTheDocument();
|
|
186
185
|
});
|
|
187
186
|
|
|
188
187
|
it('does NOT nag when the API reports it applied them', async () => {
|
|
@@ -197,52 +196,18 @@ describe('TrackerPage — what is outstanding', () => {
|
|
|
197
196
|
expect(screen.queryByText(/did not filter by/i)).not.toBeInTheDocument();
|
|
198
197
|
});
|
|
199
198
|
|
|
200
|
-
it('
|
|
201
|
-
render(<TrackerPage api={makeApi()} scope={SCOPE} now={NOW}
|
|
202
|
-
await screen.findByText('Chase the inventor for comments on 2148');
|
|
203
|
-
const today = screen.getByRole('region', { name: 'Today' });
|
|
204
|
-
expect(within(today).getByText('Send the equity sheet to Harry Holcomb')).toBeInTheDocument();
|
|
205
|
-
expect(within(today).getByText('5d late')).toBeInTheDocument();
|
|
206
|
-
const noDate = screen.getByRole('region', { name: 'No date' });
|
|
207
|
-
expect(within(noDate).getByText('Chase the inventor for comments on 2148')).toBeInTheDocument();
|
|
208
|
-
expect(screen.getByTestId('tracker-summary')).toHaveTextContent('2 owed · 1 today');
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
it('keeps meeting statements off the list and behind a fold', async () => {
|
|
212
|
-
const rows = [
|
|
213
|
-
...ROWS,
|
|
214
|
-
commitment({ externalId: 'commit:dec', title: 'We decided to move the beta', subtype: 'decision' }),
|
|
215
|
-
];
|
|
216
|
-
render(<TrackerPage api={makeApi({ rows })} scope={SCOPE} now={NOW} />);
|
|
217
|
-
await screen.findByText('Chase the inventor for comments on 2148');
|
|
218
|
-
expect(screen.getByText(/Decisions and questions \(1\)/)).toBeInTheDocument();
|
|
219
|
-
expect(within(screen.getByRole('region', { name: 'No date' })).queryByText('We decided to move the beta')).toBeNull();
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
it('hides undated items nobody touched in 90 days behind Stale, and archives them in one click', async () => {
|
|
223
|
-
const stale = commitment({
|
|
224
|
-
externalId: 'commit:stale', title: 'An old promise', lastSeenAt: '2026-04-01T00:00:00Z', firstSeenAt: '2026-03-01T00:00:00Z',
|
|
225
|
-
});
|
|
226
|
-
const patches: Array<[string, unknown]> = [];
|
|
227
|
-
const api = makeApi({ rows: [...ROWS, stale] });
|
|
228
|
-
api.updateCommitment = async (item, patch) => { patches.push([item.externalId, patch.status]); return item; };
|
|
229
|
-
render(<TrackerPage api={api} scope={SCOPE} now={NOW} />);
|
|
199
|
+
it('even against a server that ignores the filter, finished work is never shown as owed', async () => {
|
|
200
|
+
render(<TrackerPage api={makeApi()} scope={SCOPE} now={NOW} />);
|
|
230
201
|
await screen.findByText('Chase the inventor for comments on 2148');
|
|
231
|
-
expect(screen.
|
|
232
|
-
expect(within(screen.getByRole('region', { name: 'No date' })).queryByText('An old promise')).toBeNull();
|
|
233
|
-
await userEvent.click(screen.getByRole('button', { name: 'Archive' }));
|
|
234
|
-
expect(patches).toEqual([['commit:stale', 'dropped']]);
|
|
202
|
+
expect(screen.queryByText('File the PCT for 2205')).not.toBeInTheDocument();
|
|
235
203
|
});
|
|
236
204
|
|
|
237
|
-
it('reads finished
|
|
205
|
+
it('Status "Done" reads finished to-dos from the server, one status each', async () => {
|
|
238
206
|
const queries: CommitmentQuery[] = [];
|
|
239
|
-
|
|
240
|
-
render(<TrackerPage api={api} scope={SCOPE} now={NOW} />);
|
|
207
|
+
render(<TrackerPage api={makeApi({ onQuery: (q) => queries.push(q), appliedFilters: ['status'] })} scope={SCOPE} now={NOW} />);
|
|
241
208
|
await screen.findByText('Chase the inventor for comments on 2148');
|
|
242
|
-
|
|
243
|
-
await
|
|
244
|
-
expect(await screen.findByText('File the PCT for 2205')).toBeInTheDocument();
|
|
245
|
-
expect(queries.some((q) => Array.isArray(q.status) && q.status.includes('done'))).toBe(true);
|
|
209
|
+
await userEvent.selectOptions(screen.getByRole('combobox', { name: 'Status' }), 'done');
|
|
210
|
+
await vi.waitFor(() => expect(queries.at(-1)?.status).toEqual(['done', 'dropped']));
|
|
246
211
|
});
|
|
247
212
|
|
|
248
213
|
it('tells a fresh workspace what to do instead of showing an empty page', async () => {
|
|
@@ -637,7 +602,8 @@ describe('TrackerPage — adding a to-do', () => {
|
|
|
637
602
|
const api = { ...makeApi({ onQuery: () => { calls += 1; } }), createCommitment } as CommitmentTrackerApi;
|
|
638
603
|
render(<TrackerPage api={api} scope={SCOPE} />);
|
|
639
604
|
await screen.findByText('Chase the inventor for comments on 2148');
|
|
640
|
-
await userEvent.
|
|
605
|
+
await userEvent.click(screen.getByRole('button', { name: /Add to-do/ }));
|
|
606
|
+
await userEvent.type(screen.getByRole('textbox', { name: 'New to-do title' }), 'Call the notary{Enter}');
|
|
641
607
|
expect(createCommitment).toHaveBeenCalledWith(expect.objectContaining({ title: 'Call the notary' }));
|
|
642
608
|
await vi.waitFor(() => expect(calls).toBeGreaterThan(1));
|
|
643
609
|
});
|
|
@@ -645,18 +611,11 @@ describe('TrackerPage — adding a to-do', () => {
|
|
|
645
611
|
it('offers no quick-add when the api cannot create', async () => {
|
|
646
612
|
render(<TrackerPage api={makeApi()} scope={SCOPE} />);
|
|
647
613
|
await screen.findByText('Chase the inventor for comments on 2148');
|
|
648
|
-
expect(screen.queryByRole('
|
|
614
|
+
expect(screen.queryByRole('button', { name: /Add to-do/ })).toBeNull();
|
|
649
615
|
});
|
|
650
616
|
});
|
|
651
617
|
|
|
652
|
-
describe('TrackerPage —
|
|
653
|
-
it('says so when nothing has been finished', async () => {
|
|
654
|
-
render(<TrackerPage api={makeApi({ rows: ROWS.filter((r) => r.status !== 'done') })} scope={SCOPE} now={NOW} />);
|
|
655
|
-
await screen.findByText('Chase the inventor for comments on 2148');
|
|
656
|
-
await userEvent.click(screen.getByText('Done'));
|
|
657
|
-
expect(await screen.findByText(/nothing finished yet/i)).toBeInTheDocument();
|
|
658
|
-
});
|
|
659
|
-
|
|
618
|
+
describe('TrackerPage — blocked reason', () => {
|
|
660
619
|
it('shows why a blocked to-do is blocked', async () => {
|
|
661
620
|
const rows = [commitment({ externalId: 'commit:b1', title: 'Share the staging link', status: 'blocked', statusReason: 'Waiting on DNS' })];
|
|
662
621
|
render(<TrackerPage api={makeApi({ rows })} scope={SCOPE} now={NOW} />);
|
|
@@ -665,115 +624,13 @@ describe('TrackerPage — done fold and blocked reason', () => {
|
|
|
665
624
|
});
|
|
666
625
|
|
|
667
626
|
describe('TrackerPage — filtering', () => {
|
|
668
|
-
it('
|
|
669
|
-
render(<TrackerPage api={makeApi()} scope={SCOPE} now={NOW} projectNames={{}} />);
|
|
670
|
-
await screen.findByText('Chase the inventor for comments on 2148');
|
|
671
|
-
const box = screen.getByRole('searchbox', { name: /filter to-dos/i });
|
|
672
|
-
await userEvent.type(box, 'equity');
|
|
673
|
-
expect(screen.getByText('Send the equity sheet to Harry Holcomb')).toBeInTheDocument();
|
|
674
|
-
expect(screen.queryByText('Chase the inventor for comments on 2148')).toBeNull();
|
|
675
|
-
await userEvent.clear(box);
|
|
676
|
-
await userEvent.type(box, 'rae');
|
|
677
|
-
expect(screen.getByText('Chase the inventor for comments on 2148')).toBeInTheDocument();
|
|
678
|
-
await userEvent.clear(box);
|
|
679
|
-
await userEvent.type(box, 'zzzz');
|
|
680
|
-
expect(screen.getByText(/no to-dos match/i)).toBeInTheDocument();
|
|
681
|
-
expect(screen.queryByText(/nothing is owed/i)).toBeNull();
|
|
682
|
-
});
|
|
683
|
-
});
|
|
684
|
-
|
|
685
|
-
describe('TrackerPage — paging a large list', () => {
|
|
686
|
-
it('loads the next server page on request and appends it', async () => {
|
|
687
|
-
const pages: Record<number, Commitment[]> = {
|
|
688
|
-
1: [commitment({ externalId: 'commit:p1', title: 'First page item' })],
|
|
689
|
-
2: [commitment({ externalId: 'commit:p2', title: 'Second page item' })],
|
|
690
|
-
};
|
|
691
|
-
const seen: number[] = [];
|
|
692
|
-
const api: CommitmentTrackerApi = {
|
|
693
|
-
async listCommitments(query: CommitmentQuery = {}) {
|
|
694
|
-
const page = query.page ?? 1;
|
|
695
|
-
if (query.status) seen.push(page);
|
|
696
|
-
return { count: 2, next: page === 1 ? 'more' : null, previous: null, results: pages[page] ?? [], appliedFilters: [] };
|
|
697
|
-
},
|
|
698
|
-
};
|
|
699
|
-
render(<TrackerPage api={api} scope={SCOPE} now={NOW} />);
|
|
700
|
-
await screen.findByText('First page item');
|
|
701
|
-
expect(screen.queryByText('Second page item')).toBeNull();
|
|
702
|
-
await userEvent.click(screen.getByRole('button', { name: /load more/i }));
|
|
703
|
-
expect(await screen.findByText('Second page item')).toBeInTheDocument();
|
|
704
|
-
expect(screen.getByText('First page item')).toBeInTheDocument();
|
|
705
|
-
expect(seen).toEqual([1, 2]);
|
|
706
|
-
expect(screen.queryByRole('button', { name: /load more/i })).toBeNull();
|
|
707
|
-
});
|
|
708
|
-
});
|
|
709
|
-
|
|
710
|
-
describe('TrackerPage — quick filters', () => {
|
|
711
|
-
it('narrows to overdue, blocked or in progress with one click, and back to all', async () => {
|
|
712
|
-
const rows = [
|
|
713
|
-
commitment({ externalId: 'commit:late', title: 'Late one', dueAt: '2026-08-05T00:00:00Z' }),
|
|
714
|
-
commitment({ externalId: 'commit:blk', title: 'Stuck one', status: 'blocked', statusReason: 'waiting' }),
|
|
715
|
-
commitment({ externalId: 'commit:wip', title: 'Moving one', status: 'in_progress' }),
|
|
716
|
-
];
|
|
717
|
-
render(<TrackerPage api={makeApi({ rows })} scope={SCOPE} now={NOW} />);
|
|
718
|
-
await screen.findByText('Late one');
|
|
719
|
-
await userEvent.click(screen.getByRole('button', { name: 'Overdue' }));
|
|
720
|
-
expect(screen.getByText('Late one')).toBeInTheDocument();
|
|
721
|
-
expect(screen.queryByText('Stuck one')).toBeNull();
|
|
722
|
-
await userEvent.click(screen.getByRole('button', { name: 'Blocked' }));
|
|
723
|
-
expect(screen.getByText('Stuck one')).toBeInTheDocument();
|
|
724
|
-
expect(screen.queryByText('Late one')).toBeNull();
|
|
725
|
-
await userEvent.click(screen.getByRole('button', { name: 'In progress' }));
|
|
726
|
-
expect(screen.getByText('Moving one')).toBeInTheDocument();
|
|
727
|
-
await userEvent.click(screen.getByRole('button', { name: 'All' }));
|
|
728
|
-
expect(screen.getByText('Late one')).toBeInTheDocument();
|
|
729
|
-
expect(screen.getByText('Stuck one')).toBeInTheDocument();
|
|
730
|
-
});
|
|
731
|
-
});
|
|
732
|
-
|
|
733
|
-
describe('TrackerPage — sort and board', () => {
|
|
734
|
-
const rows = [
|
|
735
|
-
commitment({ externalId: 'commit:b', title: 'Bravo', ownerName: 'Zed', dueAt: '2026-08-20T00:00:00Z', lastSeenAt: '2026-08-02T00:00:00Z' }),
|
|
736
|
-
commitment({ externalId: 'commit:a', title: 'Alpha', ownerName: 'Amy', dueAt: '2026-08-25T00:00:00Z', lastSeenAt: '2026-08-09T00:00:00Z' }),
|
|
737
|
-
commitment({ externalId: 'commit:c', title: 'Charlie', status: 'blocked', statusReason: 'waiting', dueAt: '2026-08-30T00:00:00Z' }),
|
|
738
|
-
];
|
|
739
|
-
const order = () => screen.getAllByRole('listitem').map((li) => li.textContent ?? '');
|
|
740
|
-
|
|
741
|
-
it('asks the SERVER for the chosen order and re-reads page one', async () => {
|
|
627
|
+
it('search is a server parameter, and says when nothing matches', async () => {
|
|
742
628
|
const queries: CommitmentQuery[] = [];
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
await userEvent.
|
|
747
|
-
await vi.waitFor(() => expect(queries.at(-1)?.
|
|
748
|
-
expect(queries.at(-1)?.page).toBeUndefined();
|
|
749
|
-
});
|
|
750
|
-
|
|
751
|
-
it('orders rows within a group by the chosen sort', async () => {
|
|
752
|
-
render(<TrackerPage api={makeApi({ rows })} scope={SCOPE} now={NOW} />);
|
|
753
|
-
await screen.findByText('Alpha');
|
|
754
|
-
const pos = (t: string[]) => (name: string) => t.findIndex((x) => x.includes(name));
|
|
755
|
-
let p = pos(order());
|
|
756
|
-
expect(p('Bravo')).toBeLessThan(p('Alpha'));
|
|
757
|
-
await userEvent.selectOptions(screen.getByRole('combobox', { name: /sort to-dos/i }), 'title');
|
|
758
|
-
p = pos(order());
|
|
759
|
-
expect(p('Alpha')).toBeLessThan(p('Bravo'));
|
|
760
|
-
await userEvent.selectOptions(screen.getByRole('combobox', { name: /sort to-dos/i }), 'updated');
|
|
761
|
-
p = pos(order());
|
|
762
|
-
expect(p('Alpha')).toBeLessThan(p('Bravo'));
|
|
763
|
-
});
|
|
764
|
-
|
|
765
|
-
it('shows the same to-dos as a board with one column per status, and back', async () => {
|
|
766
|
-
render(<TrackerPage api={makeApi({ rows })} scope={SCOPE} now={NOW} />);
|
|
767
|
-
await screen.findByText('Alpha');
|
|
768
|
-
await userEvent.click(screen.getByRole('button', { name: 'Board' }));
|
|
769
|
-
const blocked = screen.getByRole('region', { name: 'Blocked column' });
|
|
770
|
-
expect(within(blocked).getByText('Charlie')).toBeInTheDocument();
|
|
771
|
-
const open = screen.getByRole('region', { name: 'Open column' });
|
|
772
|
-
expect(within(open).getByText('Alpha')).toBeInTheDocument();
|
|
773
|
-
expect(within(open).queryByText('Charlie')).toBeNull();
|
|
774
|
-
expect(screen.queryByRole('region', { name: 'Up next' })).toBeNull();
|
|
775
|
-
await userEvent.click(screen.getByRole('button', { name: 'List' }));
|
|
776
|
-
expect(screen.queryByTestId('tracker-board')).toBeNull();
|
|
629
|
+
const api = makeApi({ onQuery: (q) => queries.push(q), appliedFilters: ['status', 'search'] });
|
|
630
|
+
render(<TrackerPage api={api} scope={SCOPE} now={NOW} projectNames={{}} />);
|
|
631
|
+
await screen.findByText('Chase the inventor for comments on 2148');
|
|
632
|
+
await userEvent.type(screen.getByRole('searchbox', { name: 'Search to-dos' }), 'equity');
|
|
633
|
+
await vi.waitFor(() => expect(queries.at(-1)?.search).toBe('equity'));
|
|
777
634
|
});
|
|
778
635
|
});
|
|
779
636
|
|
|
@@ -793,19 +650,17 @@ describe('TrackerPage — 400+ open to-dos, paged by the server (bd startsim-768
|
|
|
793
650
|
};
|
|
794
651
|
}
|
|
795
652
|
|
|
796
|
-
it('loads
|
|
653
|
+
it('loads one page at a time, never the whole set, and the footer reaches the last page', async () => {
|
|
797
654
|
const queries: CommitmentQuery[] = [];
|
|
798
655
|
render(<TrackerPage api={pagedApi((q) => queries.push(q))} scope={SCOPE} now={NOW} />);
|
|
799
656
|
await screen.findByText('Todo 000');
|
|
800
|
-
expect(screen.getByText(
|
|
801
|
-
expect(
|
|
802
|
-
await userEvent.click(screen.getByRole('button', { name: '
|
|
803
|
-
await screen.findByText(
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
expect(
|
|
807
|
-
expect(screen.getAllByText(/^Todo \d{3}$/)).toHaveLength(437);
|
|
808
|
-
expect(queries.filter((q) => q.page).map((q) => q.page)).toEqual([2, 3]);
|
|
657
|
+
expect(screen.getByText('1-25 of 437')).toBeInTheDocument();
|
|
658
|
+
expect(screen.getAllByText(/^Todo \d{3}$/)).toHaveLength(25);
|
|
659
|
+
await userEvent.click(screen.getByRole('button', { name: 'Last page' }));
|
|
660
|
+
await screen.findByText('Todo 436');
|
|
661
|
+
expect(screen.getByText('426-437 of 437')).toBeInTheDocument();
|
|
662
|
+
expect(queries.every((q) => (q.pageSize ?? 0) <= 100)).toBe(true);
|
|
663
|
+
expect(queries.filter((q) => q.page && q.page > 1).map((q) => q.page)).toEqual([18]);
|
|
809
664
|
});
|
|
810
665
|
});
|
|
811
666
|
|
|
@@ -816,7 +671,8 @@ describe('TrackerPage — a guessed project (bd startsim-tmrvi.22)', () => {
|
|
|
816
671
|
commitment({ externalId: 'commit:g2', title: 'Call the plumber', focusId: 'f1' }),
|
|
817
672
|
];
|
|
818
673
|
render(<TrackerPage api={makeApi({ rows })} scope={SCOPE} now={NOW} projectNames={{ f1: 'Home admin' }} />);
|
|
819
|
-
expect(await screen.findByText(
|
|
820
|
-
expect(screen.getAllByText(
|
|
674
|
+
expect(await screen.findByText(/\(guessed\)/)).toBeInTheDocument();
|
|
675
|
+
expect(within(screen.getByTestId('table-todos')).getAllByText(/Home admin/)).toHaveLength(2);
|
|
676
|
+
expect(screen.getAllByText(/\(guessed\)/)).toHaveLength(1);
|
|
821
677
|
});
|
|
822
678
|
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
PAGE_SIZES, DEFAULT_PAGE_SIZE, nextSort, pageCount, clampPage, rangeLabel, parsePageInput,
|
|
5
|
+
readPageSize, writePageSize, ariaSort,
|
|
6
|
+
} from '../components/table/table-logic';
|
|
7
|
+
|
|
8
|
+
describe('table sorting', () => {
|
|
9
|
+
it('first click ascends, second descends, third on a new column starts ascending again', () => {
|
|
10
|
+
expect(nextSort(null, 'due')).toEqual({ key: 'due', dir: 'asc' });
|
|
11
|
+
expect(nextSort({ key: 'due', dir: 'asc' }, 'due')).toEqual({ key: 'due', dir: 'desc' });
|
|
12
|
+
expect(nextSort({ key: 'due', dir: 'desc' }, 'due')).toEqual({ key: 'due', dir: 'asc' });
|
|
13
|
+
expect(nextSort({ key: 'due', dir: 'desc' }, 'title')).toEqual({ key: 'title', dir: 'asc' });
|
|
14
|
+
});
|
|
15
|
+
it('reports aria-sort only on the sorted column', () => {
|
|
16
|
+
expect(ariaSort({ key: 'due', dir: 'desc' }, 'due')).toBe('descending');
|
|
17
|
+
expect(ariaSort({ key: 'due', dir: 'asc' }, 'due')).toBe('ascending');
|
|
18
|
+
expect(ariaSort({ key: 'due', dir: 'asc' }, 'title')).toBe('none');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe('table paging', () => {
|
|
23
|
+
it('offers 25, 50, 100 and defaults to 25', () => {
|
|
24
|
+
expect([...PAGE_SIZES]).toEqual([25, 50, 100]);
|
|
25
|
+
expect(DEFAULT_PAGE_SIZE).toBe(25);
|
|
26
|
+
});
|
|
27
|
+
it('counts pages, never fewer than one', () => {
|
|
28
|
+
expect(pageCount(0, 25)).toBe(1);
|
|
29
|
+
expect(pageCount(41, 25)).toBe(2);
|
|
30
|
+
expect(pageCount(50, 25)).toBe(2);
|
|
31
|
+
expect(pageCount(51, 25)).toBe(3);
|
|
32
|
+
});
|
|
33
|
+
it('clamps a page into range', () => {
|
|
34
|
+
expect(clampPage(0, 41, 25)).toBe(1);
|
|
35
|
+
expect(clampPage(9, 41, 25)).toBe(2);
|
|
36
|
+
expect(clampPage(2, 41, 25)).toBe(2);
|
|
37
|
+
});
|
|
38
|
+
it('labels the visible range', () => {
|
|
39
|
+
expect(rangeLabel(1, 25, 41)).toBe('1-25 of 41');
|
|
40
|
+
expect(rangeLabel(2, 25, 41)).toBe('26-41 of 41');
|
|
41
|
+
expect(rangeLabel(1, 25, 0)).toBe('0 of 0');
|
|
42
|
+
expect(rangeLabel(1, 25, 13)).toBe('1-13 of 13');
|
|
43
|
+
});
|
|
44
|
+
it('parses the jump box: whole numbers in range, otherwise nothing', () => {
|
|
45
|
+
expect(parsePageInput('2', 5)).toBe(2);
|
|
46
|
+
expect(parsePageInput(' 3 ', 5)).toBe(3);
|
|
47
|
+
expect(parsePageInput('9', 5)).toBe(5);
|
|
48
|
+
expect(parsePageInput('0', 5)).toBe(1);
|
|
49
|
+
expect(parsePageInput('', 5)).toBeNull();
|
|
50
|
+
expect(parsePageInput('abc', 5)).toBeNull();
|
|
51
|
+
expect(parsePageInput('2.5', 5)).toBeNull();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('remembered rows per page', () => {
|
|
56
|
+
const store = (init: Record<string, string> = {}) => {
|
|
57
|
+
const m = { ...init };
|
|
58
|
+
return { getItem: (k: string) => m[k] ?? null, setItem: (k: string, v: string) => { m[k] = v; }, m };
|
|
59
|
+
};
|
|
60
|
+
it('is remembered per table', () => {
|
|
61
|
+
const s = store();
|
|
62
|
+
writePageSize('todos', 50, s);
|
|
63
|
+
writePageSize('timeline', 100, s);
|
|
64
|
+
expect(readPageSize('todos', s)).toBe(50);
|
|
65
|
+
expect(readPageSize('timeline', s)).toBe(100);
|
|
66
|
+
expect(readPageSize('library', s)).toBe(25);
|
|
67
|
+
});
|
|
68
|
+
it('ignores junk and survives storage that throws', () => {
|
|
69
|
+
expect(readPageSize('todos', store({ 'tandem.table.todos.pageSize': '7' }))).toBe(25);
|
|
70
|
+
const bad = { getItem: () => { throw new Error('blocked'); }, setItem: () => { throw new Error('blocked'); } };
|
|
71
|
+
expect(readPageSize('todos', bad)).toBe(25);
|
|
72
|
+
expect(() => writePageSize('todos', 50, bad)).not.toThrow();
|
|
73
|
+
expect(readPageSize('todos', null)).toBe(25);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { cleanup, fireEvent, render, screen, within } from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
import { DataTable, TableToolbar, FilterSelect, type DataTableColumn } from '../components/table';
|
|
6
|
+
|
|
7
|
+
afterEach(cleanup);
|
|
8
|
+
|
|
9
|
+
interface Row { id: string; name: string; when: string }
|
|
10
|
+
const COLS: Array<DataTableColumn<Row>> = [
|
|
11
|
+
{ key: 'name', header: 'Name', sortable: true, render: (r) => r.name },
|
|
12
|
+
{ key: 'when', header: 'When', sortable: true, render: (r) => r.when },
|
|
13
|
+
{ key: 'plain', header: 'Plain', render: () => 'x' },
|
|
14
|
+
];
|
|
15
|
+
const ROWS: Row[] = [{ id: '1', name: 'Alpha', when: 'Mon' }, { id: '2', name: 'Beta', when: 'Tue' }];
|
|
16
|
+
|
|
17
|
+
function table(over: Partial<React.ComponentProps<typeof DataTable<Row>>> = {}) {
|
|
18
|
+
const props = {
|
|
19
|
+
tableId: 't', columns: COLS, rows: ROWS, rowKey: (r: Row) => r.id,
|
|
20
|
+
sort: null, onSort: vi.fn(), page: 1, pageSize: 25 as const, total: 41, onPage: vi.fn(), onPageSize: vi.fn(),
|
|
21
|
+
...over,
|
|
22
|
+
};
|
|
23
|
+
render(<DataTable {...props} />);
|
|
24
|
+
return props;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
describe('DataTable', () => {
|
|
28
|
+
it('draws one header per column and one row per record', () => {
|
|
29
|
+
table();
|
|
30
|
+
expect(screen.getAllByRole('columnheader').map((h) => h.textContent)).toEqual(['Name', 'When', 'Plain']);
|
|
31
|
+
expect(screen.getAllByRole('row')).toHaveLength(1 + ROWS.length);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('only sortable headers are buttons, and a click asks for that column ascending', () => {
|
|
35
|
+
const p = table();
|
|
36
|
+
expect(screen.queryByRole('button', { name: /Plain/ })).toBeNull();
|
|
37
|
+
fireEvent.click(screen.getByRole('button', { name: /Name/ }));
|
|
38
|
+
expect(p.onSort).toHaveBeenCalledWith({ key: 'name', dir: 'asc' });
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('clicking the sorted header flips direction and marks aria-sort', () => {
|
|
42
|
+
const p = table({ sort: { key: 'name', dir: 'asc' } });
|
|
43
|
+
expect(screen.getByRole('columnheader', { name: /Name/ }).getAttribute('aria-sort')).toBe('ascending');
|
|
44
|
+
fireEvent.click(screen.getByRole('button', { name: /Name/ }));
|
|
45
|
+
expect(p.onSort).toHaveBeenCalledWith({ key: 'name', dir: 'desc' });
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('says so when there is nothing, instead of an empty grid', () => {
|
|
49
|
+
table({ rows: [], total: 0, emptyMessage: 'Nothing here.' });
|
|
50
|
+
expect(screen.getByText('Nothing here.')).toBeTruthy();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('row click', () => {
|
|
55
|
+
it('clicking a row reports it; clicking a control inside does not', () => {
|
|
56
|
+
const onRowClick = vi.fn();
|
|
57
|
+
table({ onRowClick, columns: [...COLS, { key: 'b', header: 'B', render: () => <button type="button">inner</button> }] });
|
|
58
|
+
fireEvent.click(screen.getByText('Alpha'));
|
|
59
|
+
expect(onRowClick).toHaveBeenCalledWith(ROWS[0]);
|
|
60
|
+
onRowClick.mockClear();
|
|
61
|
+
fireEvent.click(screen.getAllByText('inner')[0]);
|
|
62
|
+
expect(onRowClick).not.toHaveBeenCalled();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe('the pagination footer', () => {
|
|
67
|
+
const footer = () => screen.getByRole('navigation', { name: 'Pagination' });
|
|
68
|
+
|
|
69
|
+
it('shows the range, page X of Y and the rows-per-page choice in one row', () => {
|
|
70
|
+
table();
|
|
71
|
+
expect(within(footer()).getByText('1-25 of 41')).toBeTruthy();
|
|
72
|
+
expect(within(footer()).getByText('of 2')).toBeTruthy();
|
|
73
|
+
const size = within(footer()).getByLabelText('Rows per page') as HTMLSelectElement;
|
|
74
|
+
expect([...size.options].map((o) => o.value)).toEqual(['25', '50', '100']);
|
|
75
|
+
expect(size.value).toBe('25');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('first/previous are disabled on page one; next/last move', () => {
|
|
79
|
+
const p = table();
|
|
80
|
+
expect((screen.getByRole('button', { name: 'First page' }) as HTMLButtonElement).disabled).toBe(true);
|
|
81
|
+
expect((screen.getByRole('button', { name: 'Previous page' }) as HTMLButtonElement).disabled).toBe(true);
|
|
82
|
+
fireEvent.click(screen.getByRole('button', { name: 'Next page' }));
|
|
83
|
+
expect(p.onPage).toHaveBeenCalledWith(2);
|
|
84
|
+
fireEvent.click(screen.getByRole('button', { name: 'Last page' }));
|
|
85
|
+
expect(p.onPage).toHaveBeenCalledWith(2);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('on the last page next/last are disabled', () => {
|
|
89
|
+
table({ page: 2 });
|
|
90
|
+
expect(within(footer()).getByText('26-41 of 41')).toBeTruthy();
|
|
91
|
+
expect((screen.getByRole('button', { name: 'Next page' }) as HTMLButtonElement).disabled).toBe(true);
|
|
92
|
+
expect((screen.getByRole('button', { name: 'Last page' }) as HTMLButtonElement).disabled).toBe(true);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('Enter in the jump box goes to that page, clamped; junk does nothing', () => {
|
|
96
|
+
const p = table({ total: 120 });
|
|
97
|
+
const jump = screen.getByLabelText('Go to page') as HTMLInputElement;
|
|
98
|
+
fireEvent.change(jump, { target: { value: '3' } });
|
|
99
|
+
fireEvent.keyDown(jump, { key: 'Enter' });
|
|
100
|
+
expect(p.onPage).toHaveBeenLastCalledWith(3);
|
|
101
|
+
fireEvent.change(jump, { target: { value: '99' } });
|
|
102
|
+
fireEvent.keyDown(jump, { key: 'Enter' });
|
|
103
|
+
expect(p.onPage).toHaveBeenLastCalledWith(5);
|
|
104
|
+
(p.onPage as ReturnType<typeof vi.fn>).mockClear();
|
|
105
|
+
fireEvent.change(jump, { target: { value: 'abc' } });
|
|
106
|
+
fireEvent.keyDown(jump, { key: 'Enter' });
|
|
107
|
+
expect(p.onPage).not.toHaveBeenCalled();
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('changing rows per page reports the size', () => {
|
|
111
|
+
const p = table();
|
|
112
|
+
fireEvent.change(screen.getByLabelText('Rows per page'), { target: { value: '50' } });
|
|
113
|
+
expect(p.onPageSize).toHaveBeenCalledWith(50);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe('TableToolbar', () => {
|
|
118
|
+
it('is one row: a labelled search, dropdowns, ONE primary action', () => {
|
|
119
|
+
const onSearch = vi.fn();
|
|
120
|
+
const onAdd = vi.fn();
|
|
121
|
+
render(
|
|
122
|
+
<TableToolbar searchLabel="Search to-dos" search="" onSearch={onSearch} action={{ label: 'Add to-do', onClick: onAdd }}>
|
|
123
|
+
<FilterSelect label="Status" value="open" options={[{ value: 'open', label: 'Open' }, { value: 'all', label: 'All' }]} onChange={() => undefined} />
|
|
124
|
+
</TableToolbar>,
|
|
125
|
+
);
|
|
126
|
+
fireEvent.change(screen.getByRole('searchbox', { name: 'Search to-dos' }), { target: { value: 'tax' } });
|
|
127
|
+
expect(onSearch).toHaveBeenCalledWith('tax');
|
|
128
|
+
expect(screen.getByRole('combobox', { name: 'Status' })).toBeTruthy();
|
|
129
|
+
fireEvent.click(screen.getByRole('button', { name: /Add to-do/ }));
|
|
130
|
+
expect(onAdd).toHaveBeenCalled();
|
|
131
|
+
expect(screen.getAllByRole('button')).toHaveLength(1);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TODAY (
|
|
3
|
-
* content is one due-soon line with the way into Plan (the list itself is Plan's).
|
|
2
|
+
* TODAY: the brief (structured when the result carries markdown, the stored text otherwise) and the week link. Nothing else.
|
|
4
3
|
*/
|
|
5
4
|
import * as React from 'react';
|
|
6
5
|
import { render, screen, within } from '@testing-library/react';
|
|
@@ -9,42 +8,17 @@ import { describe, expect, it, vi } from 'vitest';
|
|
|
9
8
|
|
|
10
9
|
import { HomeBriefPage } from '../components/pages/home';
|
|
11
10
|
import type { BriefingResult } from '../corpus/briefing';
|
|
12
|
-
import type { Commitment, CorpusApi, CommitmentApi, SourceDocument } from '../corpus/types';
|
|
13
11
|
|
|
14
|
-
const NOW = Date.parse('2026-11-06T17:00:00Z');
|
|
15
12
|
const TEXT = 'Good morning Quinn. Two things are overdue.\nFirst, send the term sheet.';
|
|
16
13
|
const RESULT = {
|
|
17
14
|
briefingId: 'b1', text: TEXT, audioUrl: '/corpus/briefing/b1/audio', items: [], remaining: 0,
|
|
18
15
|
context: { itemIds: [], localDate: '2026-11-06', timeZone: 'UTC', offsets: [] }, scriptSource: 'template', cached: true, ms: 1,
|
|
19
16
|
} as unknown as BriefingResult;
|
|
20
17
|
|
|
21
|
-
const mention = (documentId: string) => ({ documentId, originKey: 'k', occurredAt: null, quote: '', extractor: 'model' as const });
|
|
22
|
-
function item(id: string, over: Partial<Commitment> = {}): Commitment {
|
|
23
|
-
return {
|
|
24
|
-
id, externalId: `commit:${id}`, dedupeKey: id, subtype: 'action', title: id, detail: '', status: 'open', subjectKey: '', actionKey: '',
|
|
25
|
-
mentions: [], firstSeenAt: null, lastSeenAt: null, extractorVersion: 't', source: 'granola', sourceLabel: 'G', scope: { orgId: 'o' }, ...over,
|
|
26
|
-
} as Commitment;
|
|
27
|
-
}
|
|
28
|
-
const DOC = { id: 'n1', title: 'Weekly sync', body: '', summary: 'We agreed to ship Friday.', sections: [], occurredAt: '2026-11-05T10:00:00Z', source: 'granola', sourceLabel: 'G', subtype: 'meeting', sourceRef: 'x' } as unknown as SourceDocument;
|
|
29
|
-
|
|
30
|
-
function corpus(): CorpusApi & CommitmentApi {
|
|
31
|
-
const open = [
|
|
32
|
-
item('late', { dueAt: '2026-11-03', focusId: 'f1', mentions: [mention('n1')] }),
|
|
33
|
-
item('soon', { dueAt: '2026-11-09' }),
|
|
34
|
-
];
|
|
35
|
-
return {
|
|
36
|
-
async listCommitments(q = {}) {
|
|
37
|
-
const results = Array.isArray(q.status) ? open : [...open, item('done1', { status: 'done', mentions: [mention('n1')] })];
|
|
38
|
-
return { count: results.length, next: null, previous: null, results };
|
|
39
|
-
},
|
|
40
|
-
async listDocuments() { return { count: 1, next: null, previous: null, results: [DOC] }; },
|
|
41
|
-
} as unknown as CorpusApi & CommitmentApi;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
18
|
describe('HomeBriefPage', () => {
|
|
45
19
|
it('shows the stored brief text unchanged and never forces a regeneration', async () => {
|
|
46
20
|
const fetch = vi.fn(async () => RESULT);
|
|
47
|
-
render(<HomeBriefPage brief={{ fetch }}
|
|
21
|
+
render(<HomeBriefPage brief={{ fetch }} />);
|
|
48
22
|
expect((await screen.findByTestId('brief-text')).textContent).toBe(TEXT);
|
|
49
23
|
expect(fetch).toHaveBeenCalledTimes(1);
|
|
50
24
|
expect(fetch.mock.calls[0]).toHaveLength(0);
|
|
@@ -52,7 +26,7 @@ describe('HomeBriefPage', () => {
|
|
|
52
26
|
|
|
53
27
|
it('shows the weekly summary only when asked, and never loads it on mount', async () => {
|
|
54
28
|
const weekly = vi.fn(async () => ({ text: 'Here is your week. You finished two items.', audioUrl: null, audioReason: 'No audio.' }));
|
|
55
|
-
render(<HomeBriefPage brief={{ fetch: async () => RESULT }} weekly={{ fetch: weekly }}
|
|
29
|
+
render(<HomeBriefPage brief={{ fetch: async () => RESULT }} weekly={{ fetch: weekly }} />);
|
|
56
30
|
await screen.findByTestId('brief-text');
|
|
57
31
|
expect(weekly).not.toHaveBeenCalled();
|
|
58
32
|
await userEvent.click(screen.getByRole('button', { name: 'Show your week' }));
|
|
@@ -60,21 +34,32 @@ describe('HomeBriefPage', () => {
|
|
|
60
34
|
expect(weekly).toHaveBeenCalledTimes(1);
|
|
61
35
|
});
|
|
62
36
|
|
|
63
|
-
it('
|
|
64
|
-
const
|
|
65
|
-
render(<HomeBriefPage brief={{ fetch: async () => RESULT
|
|
66
|
-
const
|
|
67
|
-
expect(
|
|
68
|
-
expect(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
37
|
+
it('shows the structured brief when the result carries one, and the stored text otherwise', async () => {
|
|
38
|
+
const md = '## Overdue\n- **Send the term sheet** · Acme';
|
|
39
|
+
const { unmount } = render(<HomeBriefPage brief={{ fetch: async () => ({ ...RESULT, markdown: md }) }} />);
|
|
40
|
+
const card = await screen.findByTestId('brief-text');
|
|
41
|
+
expect(within(card).getByRole('heading', { name: 'Overdue' })).toBeInTheDocument();
|
|
42
|
+
expect(within(card).getAllByRole('listitem')).toHaveLength(1);
|
|
43
|
+
unmount();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('draws no second title: the page heading is the title', async () => {
|
|
47
|
+
render(<HomeBriefPage brief={{ fetch: async () => RESULT }} />);
|
|
48
|
+
await screen.findByTestId('brief-text');
|
|
49
|
+
expect(screen.queryByRole('heading', { name: /today.s brief/i })).toBeNull();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('has no due-soon line, no Open Plan, no Talk and no Needs your call: it is the brief and the week only', async () => {
|
|
53
|
+
render(<HomeBriefPage brief={{ fetch: async () => RESULT }} />);
|
|
54
|
+
await screen.findByTestId('brief-text');
|
|
55
|
+
expect(screen.queryByTestId('due-soon')).toBeNull();
|
|
56
|
+
expect(screen.queryByRole('button', { name: 'Open Plan' })).toBeNull();
|
|
57
|
+
expect(screen.queryByText(/Needs your call/)).toBeNull();
|
|
73
58
|
});
|
|
74
59
|
|
|
75
60
|
it('says plainly when the brief cannot load, with a retry', async () => {
|
|
76
61
|
const fetch = vi.fn().mockRejectedValueOnce(new Error('nope')).mockResolvedValue(RESULT);
|
|
77
|
-
render(<HomeBriefPage brief={{ fetch }}
|
|
62
|
+
render(<HomeBriefPage brief={{ fetch }} />);
|
|
78
63
|
expect(await screen.findByRole('alert')).toHaveTextContent('nope');
|
|
79
64
|
await userEvent.click(screen.getByRole('button', { name: 'Try again' }));
|
|
80
65
|
expect(await screen.findByTestId('brief-text')).toBeInTheDocument();
|