@startsimpli/integrations 0.2.201 → 0.2.202
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 +5 -5
- 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
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE LIBRARY'S CALL SHAPE (Quinn, 2026-11-20: "the Library takes about 25 seconds").
|
|
3
|
+
*
|
|
4
|
+
* MEASURED, on the local tandem stack (prod build, 1358 documents, 273 parties):
|
|
5
|
+
* a Library load issues ~22 API calls and the first ROWS wait on a serial chain
|
|
6
|
+
* — documents page -> relationships?entity__in -> the party roster walked six
|
|
7
|
+
* pages one after another — while the source cards wait on seven per-source
|
|
8
|
+
* counts. Each call is cheap alone (10-400 ms). Behind a server that serves one
|
|
9
|
+
* request at a time (the local tenant API is `runserver --nothreading`) or over
|
|
10
|
+
* a real network, that chain is the page: gateway log windows of 14 s and 17 s.
|
|
11
|
+
*
|
|
12
|
+
* SO THE BUDGET IS ON THE SHAPE, not on a wall clock a CI box could flake:
|
|
13
|
+
* 1. the rows paint with the ONLY calls they need — connections and the one
|
|
14
|
+
* documents page — while every other read is still pending;
|
|
15
|
+
* 2. the people on a row, the counts on a card and the party filter arrive
|
|
16
|
+
* afterwards and patch what is on screen;
|
|
17
|
+
* 3. the party roster is read in parallel, not walked page by page.
|
|
18
|
+
*/
|
|
19
|
+
import { describe, expect, it } from 'vitest';
|
|
20
|
+
import { act, render, screen, waitFor } from '@testing-library/react';
|
|
21
|
+
|
|
22
|
+
import { LibraryPage } from '../components/pages/LibraryPage';
|
|
23
|
+
import { createCorpusApi } from '../corpus/client';
|
|
24
|
+
import type { CorpusHttp } from '../corpus/client';
|
|
25
|
+
import type { TenantEntity } from '../corpus/entities';
|
|
26
|
+
|
|
27
|
+
const SCOPE = { orgId: 'org_tandem' };
|
|
28
|
+
const EMPTY = { count: 0, next: null, previous: null, results: [] };
|
|
29
|
+
|
|
30
|
+
function document(id: string, title: string): TenantEntity {
|
|
31
|
+
return {
|
|
32
|
+
id, entity_type: 'source_document', external_id: `granola:${id}`, name: title,
|
|
33
|
+
org_id: SCOPE.orgId, created_at: '2026-08-01T10:00:00Z',
|
|
34
|
+
data: { source: 'granola', title, summary: `Summary of ${title}.`, occurred_at: '2026-08-01T09:00:00Z' },
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function party(id: string, name: string): TenantEntity {
|
|
39
|
+
return {
|
|
40
|
+
id, entity_type: 'party', external_id: `person:${id}`, name,
|
|
41
|
+
org_id: SCOPE.orgId, created_at: '2026-08-01T10:00:00Z', data: { name, kind: 'person' },
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const DOCS = [document('d1', 'Quarterly plan'), document('d2', 'Vendor review')];
|
|
46
|
+
const PEOPLE = Array.from({ length: 250 }, (_, i) => party(`p${i}`, i === 0 ? 'Ada Lovelace' : `Person ${i}`));
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The wire. `held` reads wait on `release()`: they stand in for a slow or
|
|
50
|
+
* queued backend, so what the screen does WHILE they are outstanding is the
|
|
51
|
+
* thing under test.
|
|
52
|
+
*/
|
|
53
|
+
function wire() {
|
|
54
|
+
const calls: Array<{ path: string; params: Record<string, unknown>; at: number }> = [];
|
|
55
|
+
const held: Array<() => void> = [];
|
|
56
|
+
let tick = 0;
|
|
57
|
+
const later = <T,>(value: T): Promise<T> => new Promise((resolve) => { held.push(() => resolve(value)); });
|
|
58
|
+
let rosterInFlight = 0;
|
|
59
|
+
let rosterPeak = 0;
|
|
60
|
+
|
|
61
|
+
const http: CorpusHttp = {
|
|
62
|
+
async get<T>(path: string, init?: { params?: Record<string, unknown> }): Promise<T> {
|
|
63
|
+
const params = init?.params ?? {};
|
|
64
|
+
calls.push({ path, params, at: tick += 1 });
|
|
65
|
+
|
|
66
|
+
if (path.includes('connections')) {
|
|
67
|
+
return {
|
|
68
|
+
count: 1, next: null, previous: null,
|
|
69
|
+
results: [{ connector_key: 'granola', connector_name: 'Granola', status: 'active', last_synced_at: new Date().toISOString() }],
|
|
70
|
+
} as T;
|
|
71
|
+
}
|
|
72
|
+
if (path.includes('relationships')) {
|
|
73
|
+
return later({
|
|
74
|
+
count: 1, next: null, previous: null, applied_filters: ['entity__in'],
|
|
75
|
+
results: [{ id: 'e1', source: 'd1', target: 'p0', rel_type: 'authored_by' }],
|
|
76
|
+
}) as Promise<T>;
|
|
77
|
+
}
|
|
78
|
+
if (path.includes('facets')) return EMPTY as T;
|
|
79
|
+
if (params.type === 'party') {
|
|
80
|
+
// The roster is walked 100 at a time; the tail has to be asked for
|
|
81
|
+
// together, not after each page returns.
|
|
82
|
+
rosterInFlight += 1;
|
|
83
|
+
rosterPeak = Math.max(rosterPeak, rosterInFlight);
|
|
84
|
+
const page = Number(params.page ?? 1);
|
|
85
|
+
const size = Number(params.page_size ?? 50);
|
|
86
|
+
const slice = PEOPLE.slice((page - 1) * size, page * size);
|
|
87
|
+
return later({
|
|
88
|
+
count: PEOPLE.length, next: page * size < PEOPLE.length ? `?page=${page + 1}` : null,
|
|
89
|
+
previous: null, results: slice,
|
|
90
|
+
}).then((v) => { rosterInFlight -= 1; return v; }) as Promise<T>;
|
|
91
|
+
}
|
|
92
|
+
if (params.source) {
|
|
93
|
+
return later({ count: 1358, next: null, previous: null, applied_filters: ['source'], results: [DOCS[0]] }) as Promise<T>;
|
|
94
|
+
}
|
|
95
|
+
// THE DOCUMENTS PAGE — the one read the rows are entitled to wait for.
|
|
96
|
+
return { count: DOCS.length, next: null, previous: null, results: DOCS } as T;
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
http, calls,
|
|
102
|
+
rosterPeak: () => rosterPeak,
|
|
103
|
+
release: async () => { for (let i = 0; i < 20; i += 1) { held.splice(0).forEach((fn) => fn()); await act(async () => { await Promise.resolve(); }); } },
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
describe('Library call shape', () => {
|
|
108
|
+
it('paints the rows while participants, counts and the party list are still in flight', async () => {
|
|
109
|
+
const w = wire();
|
|
110
|
+
const api = createCorpusApi({ http: w.http, scope: SCOPE });
|
|
111
|
+
render(<LibraryPage api={api} scope={SCOPE} />);
|
|
112
|
+
|
|
113
|
+
// Rows on screen with every held read still outstanding.
|
|
114
|
+
expect(await screen.findByText('Quarterly plan')).toBeTruthy();
|
|
115
|
+
expect(await screen.findByText('Vendor review')).toBeTruthy();
|
|
116
|
+
|
|
117
|
+
const before = w.calls.map((c) => c.path);
|
|
118
|
+
// Nothing the rows do not need may have BLOCKED them: the relationships
|
|
119
|
+
// read and the roster were not awaited (they may have started, but they
|
|
120
|
+
// are held, and the rows are up).
|
|
121
|
+
expect(before.some((p) => p.includes('connections'))).toBe(true);
|
|
122
|
+
|
|
123
|
+
// Now let the deferred reads land: the count patches the card in place.
|
|
124
|
+
await w.release();
|
|
125
|
+
await waitFor(() => expect(screen.getByText(/1,?358/)).toBeTruthy());
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('asks for the documents page FIRST, before any deferred read', async () => {
|
|
129
|
+
const w = wire();
|
|
130
|
+
const api = createCorpusApi({ http: w.http, scope: SCOPE });
|
|
131
|
+
render(<LibraryPage api={api} scope={SCOPE} />);
|
|
132
|
+
await screen.findByText('Quarterly plan');
|
|
133
|
+
const firstDocs = w.calls.findIndex((c) => c.params.type === 'source_document' && !c.params.source && c.params.page_size !== 1);
|
|
134
|
+
const firstDeferred = w.calls.findIndex((c) => c.params.source || c.params.type === 'party' || c.path.includes('relationships'));
|
|
135
|
+
expect(firstDocs).toBeGreaterThanOrEqual(0);
|
|
136
|
+
// Order is the queue order on a server that answers one request at a time.
|
|
137
|
+
expect(firstDeferred === -1 || firstDocs < firstDeferred).toBe(true);
|
|
138
|
+
// The folder tree's facet read is the slowest on a cold tenant; it queues
|
|
139
|
+
// behind the rows, not ahead of them.
|
|
140
|
+
const firstFacets = w.calls.findIndex((c) => c.path.includes('facets'));
|
|
141
|
+
expect(firstFacets === -1 || firstDocs < firstFacets).toBe(true);
|
|
142
|
+
await w.release();
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('does not make the rows wait on the relationships or the roster', async () => {
|
|
146
|
+
const w = wire();
|
|
147
|
+
const api = createCorpusApi({ http: w.http, scope: SCOPE });
|
|
148
|
+
const page = await api.listDocuments({ page: 1, pageSize: 20 }, { participants: false });
|
|
149
|
+
expect(page.results).toHaveLength(2);
|
|
150
|
+
expect(w.calls.some((c) => c.path.includes('relationships'))).toBe(false);
|
|
151
|
+
expect(w.calls.some((c) => c.params.type === 'party')).toBe(false);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('reads the party roster in parallel, not page by page', async () => {
|
|
155
|
+
const w = wire();
|
|
156
|
+
const api = createCorpusApi({ http: w.http, scope: SCOPE });
|
|
157
|
+
const pending = api.participantsFor!(['d1']);
|
|
158
|
+
await w.release();
|
|
159
|
+
const people = await pending;
|
|
160
|
+
expect(people.get('d1')?.map((p) => p.name)).toEqual(['Ada Lovelace']);
|
|
161
|
+
// 250 people at 100 a page is three reads. Walked serially the peak is 1.
|
|
162
|
+
expect(w.rosterPeak()).toBeGreaterThanOrEqual(2);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
@@ -39,7 +39,7 @@ describe('TrackerPage when the load fails', () => {
|
|
|
39
39
|
const api = { listCommitments: async () => { calls += 1; if (calls <= 1) throw new Error('simulated outage'); return page; } } as never;
|
|
40
40
|
render(<TrackerPage api={api} scope={{} as never} classNames={{} as never} />);
|
|
41
41
|
await waitFor(() => expect(screen.getByTestId('load-error')).toBeTruthy());
|
|
42
|
-
expect(screen.
|
|
42
|
+
expect(screen.queryByText(/Nothing is owed|Nothing has been pulled/)).toBeNull();
|
|
43
43
|
fireEvent.click(screen.getByRole('button', { name: 'Try again' }));
|
|
44
44
|
await waitFor(() => expect(screen.queryByTestId('load-error')).toBeNull());
|
|
45
45
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
|
|
5
|
+
import { MiniMarkdown } from '../components/pages/home/MiniMarkdown';
|
|
6
|
+
|
|
7
|
+
describe('MiniMarkdown', () => {
|
|
8
|
+
it('renders headings, bullets and bold, and never raw markup', () => {
|
|
9
|
+
const { container } = render(<MiniMarkdown text={'## Overdue\n- **Send it** · Acme\n- second\n\n_2 more not shown._\n<script>x</script>'} />);
|
|
10
|
+
expect(screen.getByRole('heading', { level: 3, name: 'Overdue' })).toBeInTheDocument();
|
|
11
|
+
expect(screen.getAllByRole('listitem')).toHaveLength(2);
|
|
12
|
+
expect(container.querySelector('strong')?.textContent).toBe('Send it');
|
|
13
|
+
expect(container.textContent).not.toContain('##');
|
|
14
|
+
expect(container.textContent).not.toContain('**');
|
|
15
|
+
expect(container.querySelector('script')).toBeNull();
|
|
16
|
+
expect(container.textContent).toContain('<script>x</script>');
|
|
17
|
+
expect(container.querySelector('em')?.textContent).toBe('2 more not shown.');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('shows plain text (the weekly summary) as paragraphs', () => {
|
|
21
|
+
render(<MiniMarkdown text={'Here is your week.\nYou finished two items.'} />);
|
|
22
|
+
expect(screen.getByText(/Here is your week/)).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
1
|
+
import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';
|
|
2
2
|
import { describe, expect, it } from 'vitest';
|
|
3
3
|
|
|
4
4
|
import { OverviewPage } from '../components/pages/overview/OverviewPage';
|
|
@@ -6,7 +6,7 @@ import { OverviewPage } from '../components/pages/overview/OverviewPage';
|
|
|
6
6
|
const page = <T,>(results: T[]) => ({ count: results.length, next: null, previous: null, results });
|
|
7
7
|
const item = (i: number, owner: string | undefined, focusId: string, due: string | null = null) => ({ id: String(i), externalId: `c${i}`, title: `task ${i}`, status: 'open', ownerName: owner, focusId, mentions: [], dueAt: due, lastSeenAt: null });
|
|
8
8
|
const api = {
|
|
9
|
-
listFocuses: async () => page([{ id: 'f1', title: 'Alpha', status: 'active' }, { id: 'f2', title: 'Beta', status: 'at_risk' }]),
|
|
9
|
+
listFocuses: async () => page([{ id: 'f1', title: 'Alpha', status: 'active' }, { id: 'f2', title: 'Beta', status: 'at_risk' }, { id: 'f3', title: 'Gamma', status: 'draft' }]),
|
|
10
10
|
listCommitments: async () => page([item(1, 'Sam', 'f1', '2030-01-02T00:00:00Z'), item(2, 'Riley', 'f1'), item(3, 'Riley', 'f2')]),
|
|
11
11
|
} as never;
|
|
12
12
|
|
|
@@ -14,25 +14,55 @@ describe('OverviewPage', () => {
|
|
|
14
14
|
it('is one row per project with Waiting on, Next step and Open columns, not a column per person', async () => {
|
|
15
15
|
render(<OverviewPage api={api} scope={{} as never} onOpenProject={() => {}} />);
|
|
16
16
|
await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
|
|
17
|
-
expect(screen.getAllByRole('columnheader').map((h) => h.textContent?.replace(/\s*[
|
|
17
|
+
expect(screen.getAllByRole('columnheader').map((h) => h.textContent?.replace(/\s*[▲▼]$/, ''))).toEqual(['Project', 'Status', 'Waiting on', 'Next step', 'Open', 'Last activity']);
|
|
18
18
|
// the project whose most pressing item is dated shows that item and its owner, with the other person as +1
|
|
19
19
|
expect(screen.getAllByText('task 1').length).toBeGreaterThan(0);
|
|
20
20
|
expect(screen.getAllByText('+ 1 more').length).toBeGreaterThan(0);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
it('
|
|
23
|
+
it('has ONE filter control (a select) and no chips', async () => {
|
|
24
24
|
render(<OverviewPage api={api} scope={{} as never} onOpenProject={() => {}} />);
|
|
25
25
|
await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
|
|
26
|
-
|
|
26
|
+
expect(screen.getAllByRole('combobox')).toHaveLength(1);
|
|
27
|
+
expect(screen.queryByRole('group', { name: 'Waiting on' })).toBeNull();
|
|
28
|
+
expect(document.querySelector('details')).toBeNull();
|
|
29
|
+
expect(screen.getByTestId('table-overview')).toBeTruthy();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('Waiting on a person shows only that person\'s projects', async () => {
|
|
33
|
+
render(<OverviewPage api={api} scope={{} as never} onOpenProject={() => {}} />);
|
|
34
|
+
await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
|
|
35
|
+
const sam = screen.getByRole('option', { name: /^Waiting on Sam/ }) as HTMLOptionElement;
|
|
36
|
+
fireEvent.change(screen.getByRole('combobox', { name: 'Show' }), { target: { value: sam.value } });
|
|
27
37
|
expect(screen.queryAllByText('Beta').length).toBe(0);
|
|
28
38
|
expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0);
|
|
29
39
|
});
|
|
30
40
|
|
|
41
|
+
it('a project with nothing open is the SAME kind of row, quieter, behind the same control, and opens like any other', async () => {
|
|
42
|
+
const opened: string[] = [];
|
|
43
|
+
render(<OverviewPage api={api} scope={{} as never} onOpenProject={(id) => opened.push(id)} />);
|
|
44
|
+
await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
|
|
45
|
+
expect(screen.queryAllByText('Gamma').length).toBe(0);
|
|
46
|
+
fireEvent.change(screen.getByRole('combobox', { name: 'Show' }), { target: { value: 'all' } });
|
|
47
|
+
const table = screen.getByRole('table');
|
|
48
|
+
const gamma = within(table).getByRole('button', { name: 'Gamma' });
|
|
49
|
+
const row = gamma.closest('tr') as HTMLElement;
|
|
50
|
+
expect(row.className).toContain('text-gray-500');
|
|
51
|
+
expect(within(table).getByRole('button', { name: 'Alpha' }).closest('tr')?.className).not.toContain('text-gray-500');
|
|
52
|
+
expect(within(row).getAllByRole('cell')).toHaveLength(6);
|
|
53
|
+
// the whole row opens the project, not only the name
|
|
54
|
+
fireEvent.click(within(row).getAllByRole('cell')[3]);
|
|
55
|
+
expect(opened).toEqual(['f3']);
|
|
56
|
+
opened.length = 0;
|
|
57
|
+
fireEvent.click(gamma);
|
|
58
|
+
expect(opened).toEqual(['f3']);
|
|
59
|
+
});
|
|
60
|
+
|
|
31
61
|
it('with nobody named there is no Waiting-on filter and the column says so plainly', async () => {
|
|
32
62
|
const nobody = { listFocuses: async () => page([{ id: 'f1', title: 'Alpha', status: 'active' }]), listCommitments: async () => page([item(1, undefined, 'f1')]) } as never;
|
|
33
63
|
render(<OverviewPage api={nobody} scope={{} as never} onOpenProject={() => {}} />);
|
|
34
64
|
await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
|
|
35
|
-
expect(screen.queryByRole('
|
|
65
|
+
expect(screen.queryByRole('combobox')).toBeNull();
|
|
36
66
|
expect(screen.getAllByText('Nobody named').length).toBeGreaterThan(0);
|
|
37
67
|
});
|
|
38
68
|
});
|
|
@@ -67,8 +67,9 @@ describe('the to-do list as the Plan sub-tab', () => {
|
|
|
67
67
|
render(<TrackerPage api={trackerApi((q) => queries.push(q), create)} scope={SCOPE} now={NOW} showTimeline={false} focusId="focus:p1" />);
|
|
68
68
|
await screen.findByText('Todo a');
|
|
69
69
|
expect(queries[0]).toMatchObject({ focus: 'focus:p1' });
|
|
70
|
-
fireEvent.
|
|
71
|
-
fireEvent.
|
|
70
|
+
fireEvent.click(screen.getByRole('button', { name: /Add to-do/ }));
|
|
71
|
+
fireEvent.change(screen.getByLabelText('New to-do title'), { target: { value: 'Ship it' } });
|
|
72
|
+
fireEvent.keyDown(screen.getByLabelText('New to-do title'), { key: 'Enter' });
|
|
72
73
|
await waitFor(() => expect(create).toHaveBeenCalledWith({ title: 'Ship it', focusId: 'focus:p1' }));
|
|
73
74
|
});
|
|
74
75
|
|
|
@@ -115,10 +116,11 @@ describe('Projects', () => {
|
|
|
115
116
|
});
|
|
116
117
|
|
|
117
118
|
describe('Talk', () => {
|
|
118
|
-
it('is one screen:
|
|
119
|
+
it('is one screen: no subtitle, no title of its own, no mode toggle', () => {
|
|
119
120
|
render(<TalkPage talk={<p>talk body</p>} />);
|
|
120
121
|
expect(screen.getByText('talk body')).toBeTruthy();
|
|
121
|
-
expect(screen.
|
|
122
|
+
expect(screen.queryByTestId('talk-mode-subtitle')).toBeNull();
|
|
123
|
+
expect(screen.queryByRole('heading')).toBeNull();
|
|
122
124
|
expect(screen.queryByRole('tablist')).toBeNull();
|
|
123
125
|
expect(screen.queryByRole('tab')).toBeNull();
|
|
124
126
|
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { timelineEvents, relativeWhen, actorOf, EVENT_FILTERS } from '../corpus/timeline-events';
|
|
4
|
+
import type { TimelineRead } from '../corpus/tracker-timeline-client';
|
|
5
|
+
|
|
6
|
+
const NOW = Date.parse('2026-08-10T12:00:00Z');
|
|
7
|
+
const DAY = 86_400_000;
|
|
8
|
+
const iso = (ms: number) => new Date(ms).toISOString();
|
|
9
|
+
|
|
10
|
+
const read = (items: TimelineRead['items']): TimelineRead => ({ anchor: '2026-08-10', created: [], done: [], overdue: [], items, truncated: false });
|
|
11
|
+
const item = (over: Partial<TimelineRead['items'][number]> = {}): TimelineRead['items'][number] => ({
|
|
12
|
+
id: '1', externalId: 'commit:1', title: 'Send the sheet', status: 'open', dueAt: null, firstSeenAt: null, resolvedAt: null, updatedAt: null, origin: null, ...over,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe('timelineEvents', () => {
|
|
16
|
+
it('turns each to-do into plain-language events, newest first', () => {
|
|
17
|
+
const rows = timelineEvents(read([
|
|
18
|
+
item({ firstSeenAt: iso(NOW - 5 * DAY), status: 'done', resolvedAt: iso(NOW - 1 * DAY), origin: 'human' }),
|
|
19
|
+
]), NOW, 'UTC', 30);
|
|
20
|
+
expect(rows.map((r) => r.what)).toEqual(['To-do finished', 'To-do created']);
|
|
21
|
+
expect(rows[0]).toMatchObject({ title: 'Send the sheet', externalId: 'commit:1', status: 'done' });
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('an owed to-do past its date has an overdue event on its due day', () => {
|
|
25
|
+
const rows = timelineEvents(read([item({ dueAt: iso(NOW - 3 * DAY) })]), NOW, 'UTC', 30);
|
|
26
|
+
expect(rows).toHaveLength(1);
|
|
27
|
+
expect(rows[0]).toMatchObject({ kind: 'overdue', what: 'To-do went overdue', actor: 'Automatic' });
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('a done to-do is never overdue, and events outside the range are left out', () => {
|
|
31
|
+
expect(timelineEvents(read([item({ status: 'done', dueAt: iso(NOW - 3 * DAY), resolvedAt: iso(NOW - 2 * DAY) })]), NOW, 'UTC', 30).map((r) => r.kind)).toEqual(['done']);
|
|
32
|
+
expect(timelineEvents(read([item({ firstSeenAt: iso(NOW - 45 * DAY) })]), NOW, 'UTC', 30)).toHaveLength(0);
|
|
33
|
+
expect(timelineEvents(read([item({ firstSeenAt: iso(NOW - 45 * DAY) })]), NOW, 'UTC', 60)).toHaveLength(1);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('a done to-do with no completion stamp is dated by its last update and says so', () => {
|
|
37
|
+
const rows = timelineEvents(read([item({ status: 'done', updatedAt: iso(NOW - 2 * DAY) })]), NOW, 'UTC', 30);
|
|
38
|
+
expect(rows[0]).toMatchObject({ kind: 'done', estimated: true });
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('who or what did it', () => {
|
|
43
|
+
it('names the origin in plain words', () => {
|
|
44
|
+
expect(actorOf('created', 'human')).toBe('You');
|
|
45
|
+
expect(actorOf('created', 'tenant-extraction')).toBe('Meeting import');
|
|
46
|
+
expect(actorOf('created', 'linear-sync')).toBe('Tracker sync');
|
|
47
|
+
expect(actorOf('created', 'roci')).toBe('Roci');
|
|
48
|
+
expect(actorOf('created', null)).toBe('Tandem');
|
|
49
|
+
expect(actorOf('overdue', 'human')).toBe('Automatic');
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('when', () => {
|
|
54
|
+
it('relative text, exact on hover', () => {
|
|
55
|
+
expect(relativeWhen(NOW - 3 * DAY, NOW)).toBe('3 days ago');
|
|
56
|
+
expect(relativeWhen(NOW - 60_000, NOW)).toBe('1 minute ago');
|
|
57
|
+
expect(relativeWhen(NOW - 5 * 3_600_000, NOW)).toBe('5 hours ago');
|
|
58
|
+
expect(relativeWhen(NOW - 1 * DAY, NOW)).toBe('Yesterday');
|
|
59
|
+
expect(relativeWhen(NOW - 2_000, NOW)).toBe('Just now');
|
|
60
|
+
expect(relativeWhen(NOW - 40 * DAY, NOW)).toBe('Jul 1');
|
|
61
|
+
});
|
|
62
|
+
it('offers the event filters', () => {
|
|
63
|
+
expect(EVENT_FILTERS.map((f) => f.value)).toEqual(['all', 'created', 'done', 'overdue']);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
import { TimelinePage } from '../components/pages/plan';
|
|
6
|
+
|
|
7
|
+
afterEach(cleanup);
|
|
8
|
+
|
|
9
|
+
const NOW = Date.parse('2026-08-10T12:00:00Z');
|
|
10
|
+
const DAY = 86_400_000;
|
|
11
|
+
const iso = (ms: number) => new Date(ms).toISOString();
|
|
12
|
+
const item = (n: number, over: Record<string, unknown> = {}) => ({
|
|
13
|
+
id: `i${n}`, externalId: `commit:i${n}`, title: `TEST SAMPLE event ${n}`, status: 'open', dueAt: null, firstSeenAt: iso(NOW - n * DAY), resolvedAt: null, updatedAt: null, origin: 'human', ...over,
|
|
14
|
+
});
|
|
15
|
+
const api = (items: ReturnType<typeof item>[], onFilter: (f: unknown) => void = () => undefined) => ({
|
|
16
|
+
timeline: vi.fn(async (filter: unknown) => { onFilter(filter); return { anchor: '2026-08-10', created: [], done: [], overdue: [], items, truncated: false }; }),
|
|
17
|
+
}) as never;
|
|
18
|
+
const scope = { orgId: 'tandem' };
|
|
19
|
+
|
|
20
|
+
describe('the Timeline table', () => {
|
|
21
|
+
it('has what happened, when, to-do, by, status: no category, no amount', async () => {
|
|
22
|
+
render(<TimelinePage api={api([item(1)])} scope={scope} now={NOW} onOpenItem={() => undefined} />);
|
|
23
|
+
await screen.findByText('TEST SAMPLE event 1');
|
|
24
|
+
expect(screen.getAllByRole('columnheader').map((h) => h.textContent?.replace(/[▲▼]/g, ''))).toEqual(['What happened', 'When', 'To-do', 'By', 'Status']);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('says it in words: relative time with the exact time on hover, who did it, the to-do as a link', async () => {
|
|
28
|
+
const onOpen = vi.fn();
|
|
29
|
+
render(<TimelinePage api={api([item(3, { status: 'done', resolvedAt: iso(NOW - 3 * DAY) })])} scope={scope} now={NOW} onOpenItem={onOpen} />);
|
|
30
|
+
const table = await screen.findByTestId('table-timeline');
|
|
31
|
+
expect(within(table).getByText('To-do finished')).toBeTruthy();
|
|
32
|
+
const when = within(table).getAllByText('3 days ago')[0];
|
|
33
|
+
expect(when.getAttribute('title')).toMatch(/2026/);
|
|
34
|
+
expect(within(table).getAllByText('You').length).toBeGreaterThan(0);
|
|
35
|
+
fireEvent.click(within(table).getAllByRole('button', { name: 'TEST SAMPLE event 3' })[0]);
|
|
36
|
+
expect(onOpen).toHaveBeenCalledWith('commit:i3');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('shows ONE status per row (the to-do now), and the Event dropdown filters', async () => {
|
|
40
|
+
render(<TimelinePage api={api([item(1), item(2, { status: 'done', resolvedAt: iso(NOW - 2 * DAY) })])} scope={scope} now={NOW} />);
|
|
41
|
+
const table = await screen.findByTestId('table-timeline');
|
|
42
|
+
// the done to-do has two events (created, finished), each row carrying its ONE current status
|
|
43
|
+
expect(within(table).getAllByText('Done')).toHaveLength(2);
|
|
44
|
+
fireEvent.change(screen.getByRole('combobox', { name: 'Event' }), { target: { value: 'created' } });
|
|
45
|
+
expect(within(table).queryByText('To-do finished')).toBeNull();
|
|
46
|
+
expect(within(table).getAllByText('To-do created').length).toBe(2);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('search is a server filter and there is no add button', async () => {
|
|
50
|
+
const seen: unknown[] = [];
|
|
51
|
+
render(<TimelinePage api={api([item(1)], (f) => seen.push(f))} scope={scope} now={NOW} />);
|
|
52
|
+
await screen.findByText('TEST SAMPLE event 1');
|
|
53
|
+
fireEvent.change(screen.getByRole('searchbox', { name: 'Search events' }), { target: { value: 'tax' } });
|
|
54
|
+
await waitFor(() => expect(seen.at(-1)).toMatchObject({ search: 'tax' }));
|
|
55
|
+
expect(screen.queryByRole('button', { name: /Add/ })).toBeNull();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('has the shared footer, remembered size included', async () => {
|
|
59
|
+
const many = Array.from({ length: 30 }, (_, i) => item(i + 1));
|
|
60
|
+
render(<TimelinePage api={api(many)} scope={scope} now={NOW} />);
|
|
61
|
+
await screen.findByText('TEST SAMPLE event 1');
|
|
62
|
+
expect(screen.getByText(/1-25 of 30/)).toBeTruthy();
|
|
63
|
+
fireEvent.click(screen.getByRole('button', { name: 'Next page' }));
|
|
64
|
+
expect(screen.getByText('26-30 of 30')).toBeTruthy();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { commitmentOrder } from '../corpus/tracker-sort';
|
|
4
|
+
import { dueCell, statusCell, todoQuery, TODO_STATUS_FILTERS } from '../components/table/todo-model';
|
|
5
|
+
|
|
6
|
+
const DAY = 86_400_000;
|
|
7
|
+
const NOW = Date.parse('2026-08-10T12:00:00Z');
|
|
8
|
+
|
|
9
|
+
describe('server order', () => {
|
|
10
|
+
it('prefixes a minus for descending and knows status', () => {
|
|
11
|
+
expect(commitmentOrder('due', 'asc')).toBe('attr.due_at');
|
|
12
|
+
expect(commitmentOrder('due', 'desc')).toBe('-attr.due_at');
|
|
13
|
+
expect(commitmentOrder('title', 'desc')).toBe('-attr.title');
|
|
14
|
+
expect(commitmentOrder('status', 'asc')).toBe('attr.status');
|
|
15
|
+
});
|
|
16
|
+
it('keeps already-descending sorts descending unless flipped', () => {
|
|
17
|
+
expect(commitmentOrder('updated')).toBe('-attr.last_seen_at');
|
|
18
|
+
expect(commitmentOrder('updated', 'desc')).toBe('-attr.last_seen_at');
|
|
19
|
+
expect(commitmentOrder('updated', 'asc')).toBe('attr.last_seen_at');
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('the ONE status', () => {
|
|
24
|
+
it('maps every stored status to one dot + label', () => {
|
|
25
|
+
expect(statusCell('open')).toMatchObject({ label: 'To do' });
|
|
26
|
+
expect(statusCell('in_progress')).toMatchObject({ label: 'In progress' });
|
|
27
|
+
expect(statusCell('blocked')).toMatchObject({ label: 'Blocked' });
|
|
28
|
+
expect(statusCell('done')).toMatchObject({ label: 'Done' });
|
|
29
|
+
expect(statusCell('dropped')).toMatchObject({ label: 'Dropped' });
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('the due column', () => {
|
|
34
|
+
const due = (days: number | null, status: 'open' | 'done' = 'open') =>
|
|
35
|
+
dueCell({ dueAt: days === null ? null : new Date(NOW + days * DAY).toISOString(), status }, NOW, 'UTC');
|
|
36
|
+
it('says plainly how late, in red tone only when overdue and not finished', () => {
|
|
37
|
+
expect(due(-7)).toMatchObject({ text: '7 days late', tone: 'overdue' });
|
|
38
|
+
expect(due(-1)).toMatchObject({ text: '1 day late', tone: 'overdue' });
|
|
39
|
+
expect(due(-7, 'done')).toMatchObject({ tone: 'plain' });
|
|
40
|
+
});
|
|
41
|
+
it('today, tomorrow, soon, later, none', () => {
|
|
42
|
+
expect(due(0)).toMatchObject({ text: 'Today', tone: 'plain' });
|
|
43
|
+
expect(due(1)).toMatchObject({ text: 'Tomorrow', tone: 'plain' });
|
|
44
|
+
expect(due(3).text).toBe('In 3 days');
|
|
45
|
+
expect(due(20).text).toBe('Aug 30');
|
|
46
|
+
expect(due(null)).toMatchObject({ text: '–', tone: 'none' });
|
|
47
|
+
});
|
|
48
|
+
it('has the exact date for the hover', () => {
|
|
49
|
+
expect(due(-7).exact).toBe('2026-08-03');
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('todoQuery: everything the table asks for is a server parameter', () => {
|
|
54
|
+
const base = { search: '', status: 'open', project: '', sort: null, page: 1, pageSize: 25 as const };
|
|
55
|
+
it('defaults to what is still owed, tasks only, with project names', () => {
|
|
56
|
+
expect(todoQuery(base)).toMatchObject({
|
|
57
|
+
status: ['open', 'in_progress', 'blocked'], subtype: ['action', 'requirement'], withFocus: true, page: 1, pageSize: 25,
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
it('maps each status choice', () => {
|
|
61
|
+
expect(TODO_STATUS_FILTERS.map((f) => f.value)).toEqual(['open', 'todo', 'in_progress', 'blocked', 'done', 'all']);
|
|
62
|
+
expect(todoQuery({ ...base, status: 'done' }).status).toEqual(['done', 'dropped']);
|
|
63
|
+
expect(todoQuery({ ...base, status: 'blocked' }).status).toEqual(['blocked']);
|
|
64
|
+
expect(todoQuery({ ...base, status: 'todo' }).status).toEqual(['open']);
|
|
65
|
+
expect(todoQuery({ ...base, status: 'all' }).status).toBeUndefined();
|
|
66
|
+
});
|
|
67
|
+
it('sends search, project, sort direction and page to the server', () => {
|
|
68
|
+
expect(todoQuery({ ...base, search: ' tax ', project: 'focus:p1', sort: { key: 'due', dir: 'desc' }, page: 3, pageSize: 50 })).toMatchObject({
|
|
69
|
+
search: 'tax', focus: 'focus:p1', sort: 'due', sortDir: 'desc', page: 3, pageSize: 50,
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
it('a page that fixes the project (a project view) wins over the dropdown', () => {
|
|
73
|
+
expect(todoQuery({ ...base, project: 'focus:p2' }, 'focus:p1').focus).toBe('focus:p1');
|
|
74
|
+
});
|
|
75
|
+
});
|