@startsimpli/integrations 0.2.204 → 0.2.205
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 +3 -3
- package/src/__tests__/corpus-folders.test.tsx +20 -121
- package/src/__tests__/corpus-freshness.test.tsx +0 -21
- package/src/__tests__/corpus-pages.test.tsx +20 -21
- package/src/__tests__/corpus-source-strip.test.tsx +0 -63
- package/src/__tests__/library-failure-reason.test.tsx +0 -18
- package/src/__tests__/library-model.test.ts +56 -0
- package/src/__tests__/library-table.test.tsx +193 -0
- package/src/components/FolderTree.tsx +32 -16
- package/src/components/pages/LibraryPage.tsx +196 -655
- package/src/components/pages/library/LibraryTable.tsx +40 -0
- package/src/components/pages/library/LibraryTree.tsx +89 -0
- package/src/components/pages/library/library-model.ts +86 -0
- package/src/components/table/DataTable.tsx +4 -1
- package/src/corpus/client.ts +1 -0
- package/src/corpus/fixtures.ts +4 -2
- package/src/corpus/types.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startsimpli/integrations",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.205",
|
|
4
4
|
"description": "Provider-agnostic types, API clients, hooks, and UI primitives for email + calendar integrations across StartSimpli apps, plus foundry customer email (subpath ./comms).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://startsimpli.com",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"react-native-safe-area-context": ">=4.0.0",
|
|
53
53
|
"@startsimpli/auth": "^0.4.57",
|
|
54
54
|
"@startsimpli/utils": "^0.4.21",
|
|
55
|
-
"@startsimpli/ui": "^0.4.
|
|
55
|
+
"@startsimpli/ui": "^0.4.196"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"react": {
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"react-native": "0.85.3",
|
|
100
100
|
"react-native-safe-area-context": "~5.7.0",
|
|
101
101
|
"@startsimpli/llm": "0.4.31",
|
|
102
|
-
"@startsimpli/ui": "0.4.
|
|
102
|
+
"@startsimpli/ui": "0.4.196",
|
|
103
103
|
"@startsimpli/ui-native": "0.1.15",
|
|
104
104
|
"@startsimpli/auth": "0.4.57",
|
|
105
105
|
"@startsimpli/utils": "0.4.21"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* 3. A CONTROL, NEVER A SENTENCE, where the reader is asking what they may do.
|
|
24
24
|
*/
|
|
25
25
|
import { describe, expect, it } from 'vitest';
|
|
26
|
-
import { render, screen, waitFor, within } from '@testing-library/react';
|
|
26
|
+
import { configure, render, screen, waitFor, within } from '@testing-library/react';
|
|
27
27
|
import userEvent from '@testing-library/user-event';
|
|
28
28
|
|
|
29
29
|
import { FolderTree, folderTrail } from '../components/FolderTree';
|
|
@@ -38,6 +38,9 @@ import {
|
|
|
38
38
|
import type { CorpusApi, CorpusFolder, CorpusPage, FolderQuery } from '../corpus/types';
|
|
39
39
|
|
|
40
40
|
const SCOPE = { orgId: FIXTURE_ORG };
|
|
41
|
+
// The folders and counts arrive after the rows by design, so a loaded CI box needs more than the 1s default.
|
|
42
|
+
configure({ asyncUtilTimeout: 5000 });
|
|
43
|
+
|
|
41
44
|
|
|
42
45
|
/**
|
|
43
46
|
* A folder ROW by its exact name.
|
|
@@ -87,6 +90,13 @@ describe('the facet read, as the tenant really answers it', () => {
|
|
|
87
90
|
});
|
|
88
91
|
});
|
|
89
92
|
|
|
93
|
+
it('narrows to one source with attr.source, which the facet read honours', async () => {
|
|
94
|
+
const { api, facets } = tenant();
|
|
95
|
+
const page = await api.listFolders!({ under: '/', source: 'granola' });
|
|
96
|
+
expect(facets()[0].params['attr.source']).toBe('granola');
|
|
97
|
+
expect(page.results).toEqual([]);
|
|
98
|
+
});
|
|
99
|
+
|
|
90
100
|
it('sends NONE of the document filters, which the facet action would refuse', async () => {
|
|
91
101
|
// The failure being prevented: reusing the list's parameter builder. The
|
|
92
102
|
// facet action screens its vocabulary and 400s the whole read on a stray
|
|
@@ -355,10 +365,10 @@ describe('a member with a full corpus and NO folders at all', () => {
|
|
|
355
365
|
render(<LibraryPage api={pathless} scope={SCOPE} />);
|
|
356
366
|
|
|
357
367
|
expect(await screen.findByText('Meeting note 1')).toBeInTheDocument();
|
|
358
|
-
expect(await screen.findByText(/51
|
|
359
|
-
// The
|
|
368
|
+
expect(await screen.findByText(/1-25 of 51/)).toBeInTheDocument();
|
|
369
|
+
// The tree is THERE and quiet. Not hidden — a member who connects a drive
|
|
360
370
|
// tomorrow should not watch the layout rearrange — and not apologising.
|
|
361
|
-
const folders = await screen.findByLabelText('
|
|
371
|
+
const folders = await screen.findByLabelText('Sources and folders');
|
|
362
372
|
expect(within(folders).getByRole('button', { name: 'All documents' })).toHaveAttribute(
|
|
363
373
|
'aria-current', 'true',
|
|
364
374
|
);
|
|
@@ -531,68 +541,7 @@ describe('LibraryPage — one list, categorised by folder structure', () => {
|
|
|
531
541
|
const sidebar = Number(/(\d+) document/.exec(decks.getAttribute('aria-label') ?? '')![1]);
|
|
532
542
|
await user.click(decks);
|
|
533
543
|
|
|
534
|
-
expect(await screen.findByText(new RegExp(
|
|
535
|
-
});
|
|
536
|
-
|
|
537
|
-
it('offers the remedy as a control when the shelf really is empty', async () => {
|
|
538
|
-
// Narrowing to `/Decks` itself is a true zero, and the reader asked for it —
|
|
539
|
-
// but the generic empty state says "Nothing matches those filters. Clear
|
|
540
|
-
// them to see everything.", which is advice about filters they never set.
|
|
541
|
-
// A control that does the one useful thing stands there instead.
|
|
542
|
-
const user = userEvent.setup();
|
|
543
|
-
const { api } = tenant();
|
|
544
|
-
render(<LibraryPage api={api} scope={SCOPE} pageSize={50} />);
|
|
545
|
-
|
|
546
|
-
await user.click(await screen.findByRole('button', { name: folderRow('Decks') }));
|
|
547
|
-
await screen.findByText('Poppins-BoldItalic.ttf');
|
|
548
|
-
await user.click(screen.getByLabelText('Include subfolders'));
|
|
549
|
-
|
|
550
|
-
const remedy = await screen.findByRole('button', { name: 'Include subfolders' });
|
|
551
|
-
expect(screen.queryByText(/Nothing matches those filters/)).toBeNull();
|
|
552
|
-
|
|
553
|
-
await user.click(remedy);
|
|
554
|
-
expect(await screen.findByText('Poppins-BoldItalic.ttf')).toBeInTheDocument();
|
|
555
|
-
});
|
|
556
|
-
|
|
557
|
-
it('does not carry "only this shelf" into the NEXT folder', async () => {
|
|
558
|
-
// Sticky, this is the container-folder disagreement again in two clicks:
|
|
559
|
-
// uncheck on `/Decks`, click `/Contracts` — which DOES have files of its own
|
|
560
|
-
// — and the list shows 2 of the 7 the sidebar claims.
|
|
561
|
-
const user = userEvent.setup();
|
|
562
|
-
const { api, seen } = tenant();
|
|
563
|
-
render(<LibraryPage api={api} scope={SCOPE} pageSize={50} />);
|
|
564
|
-
|
|
565
|
-
await user.click(await screen.findByRole('button', { name: folderRow('Decks') }));
|
|
566
|
-
await screen.findByText('Poppins-BoldItalic.ttf');
|
|
567
|
-
await user.click(screen.getByLabelText('Include subfolders'));
|
|
568
|
-
await screen.findByRole('button', { name: 'Include subfolders' });
|
|
569
|
-
|
|
570
|
-
await user.click(screen.getByRole('button', { name: folderRow('Contracts') }));
|
|
571
|
-
|
|
572
|
-
await waitFor(() => {
|
|
573
|
-
const list = seen.filter((r) => !r.path.includes('facets')).pop()!;
|
|
574
|
-
expect(list.params['attr.path__under']).toBe('/Contracts');
|
|
575
|
-
});
|
|
576
|
-
expect((screen.getByLabelText('Include subfolders') as HTMLInputElement).checked).toBe(true);
|
|
577
|
-
});
|
|
578
|
-
|
|
579
|
-
it('offers a control to narrow to the shelf, and it really narrows', async () => {
|
|
580
|
-
// The other reading stays available — as a CONTROL, not as a hidden mode
|
|
581
|
-
// that depended on whether the search box happened to have a term in it.
|
|
582
|
-
const user = userEvent.setup();
|
|
583
|
-
const { api, seen } = tenant();
|
|
584
|
-
render(<LibraryPage api={api} scope={SCOPE} pageSize={50} />);
|
|
585
|
-
|
|
586
|
-
await user.click(await screen.findByRole('button', { name: folderRow('Decks') }));
|
|
587
|
-
await screen.findByText('Poppins-BoldItalic.ttf');
|
|
588
|
-
|
|
589
|
-
await user.click(screen.getByLabelText('Include subfolders'));
|
|
590
|
-
|
|
591
|
-
await waitFor(() => {
|
|
592
|
-
const list = seen.filter((r) => !r.path.includes('facets')).pop()!;
|
|
593
|
-
expect(list.params['attr.path']).toBe('/Decks');
|
|
594
|
-
expect(list.params['attr.path__under']).toBeUndefined();
|
|
595
|
-
});
|
|
544
|
+
expect(await screen.findByText(new RegExp(`1-\\d+ of ${sidebar}$`))).toBeInTheDocument();
|
|
596
545
|
});
|
|
597
546
|
|
|
598
547
|
it('tells the reader where they are, and lets them climb back out', async () => {
|
|
@@ -605,10 +554,9 @@ describe('LibraryPage — one list, categorised by folder structure', () => {
|
|
|
605
554
|
await user.click(await screen.findByRole('button', { name: folderRow('2022 pitch') }));
|
|
606
555
|
|
|
607
556
|
const trail = await screen.findByLabelText('Folder path');
|
|
608
|
-
expect(
|
|
609
|
-
expect(within(trail).getByText('2022 pitch')).toBeInTheDocument();
|
|
557
|
+
expect(trail).toHaveTextContent('Decks / 2022 pitch');
|
|
610
558
|
|
|
611
|
-
await user.click(within(
|
|
559
|
+
await user.click(within(screen.getByLabelText('Sources and folders')).getByRole('button', { name: 'All documents' }));
|
|
612
560
|
await waitFor(() => expect(screen.queryByLabelText('Folder path')).toBeNull());
|
|
613
561
|
});
|
|
614
562
|
|
|
@@ -633,8 +581,7 @@ describe('LibraryPage — one list, categorised by folder structure', () => {
|
|
|
633
581
|
|
|
634
582
|
await screen.findByRole('button', { name: folderRow('Contracts') });
|
|
635
583
|
await user.click(screen.getByRole('button', { name: folderRow('Contracts') }));
|
|
636
|
-
await user.type(screen.getByLabelText('Search'), 'migration');
|
|
637
|
-
await user.click(screen.getByRole('button', { name: 'Search' }));
|
|
584
|
+
await user.type(screen.getByLabelText('Search the library'), 'migration');
|
|
638
585
|
|
|
639
586
|
await waitFor(() => {
|
|
640
587
|
const list = seen.filter((r) => !r.path.includes('facets')).pop()!;
|
|
@@ -673,55 +620,7 @@ describe('LibraryPage — one list, categorised by folder structure', () => {
|
|
|
673
620
|
render(<LibraryPage api={api} scope={SCOPE} pageSize={50} />);
|
|
674
621
|
|
|
675
622
|
expect(await screen.findByText('Rate card 2026')).toBeInTheDocument();
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
});
|
|
679
|
-
|
|
680
|
-
describe('a row whose text cannot be pulled offers a DISABLED control, not a sentence', () => {
|
|
681
|
-
it('replaces the explanation with a greyed-out button', async () => {
|
|
682
|
-
const { api } = tenant();
|
|
683
|
-
render(<LibraryPage api={api} scope={SCOPE} pageSize={50} />);
|
|
684
|
-
|
|
685
|
-
// THE SENTENCE IS GONE. "No text was captured for this record." stood where
|
|
686
|
-
// a control belongs; it answered "what happened" to a reader asking "what
|
|
687
|
-
// can I do".
|
|
688
|
-
expect(await screen.findByText('Poppins-BoldItalic.ttf')).toBeInTheDocument();
|
|
689
|
-
expect(screen.queryByText(/No text was captured/)).toBeNull();
|
|
690
|
-
|
|
691
|
-
const buttons = await screen.findAllByRole('button', { name: 'Get text' });
|
|
692
|
-
expect(buttons.length).toBeGreaterThan(0);
|
|
693
|
-
// Greyed out, because the action genuinely cannot be performed: content is
|
|
694
|
-
// opt-in and this deployment pulls none (bd startsim-h6xnu).
|
|
695
|
-
expect(buttons.every((button) => (button as HTMLButtonElement).disabled)).toBe(true);
|
|
696
|
-
});
|
|
697
|
-
|
|
698
|
-
it('is live, and calls through, when the deployment CAN fetch the text', async () => {
|
|
699
|
-
// The seam is not decorative: bd startsim-99g8.2 lands into it and the same
|
|
700
|
-
// control wakes up with no change here.
|
|
701
|
-
const user = userEvent.setup();
|
|
702
|
-
const asked: string[] = [];
|
|
703
|
-
const { api } = tenant();
|
|
704
|
-
render(
|
|
705
|
-
<LibraryPage
|
|
706
|
-
api={api}
|
|
707
|
-
scope={SCOPE}
|
|
708
|
-
pageSize={50}
|
|
709
|
-
onRequestText={(document) => { asked.push(document.title); }}
|
|
710
|
-
/>,
|
|
711
|
-
);
|
|
712
|
-
|
|
713
|
-
const button = (await screen.findAllByRole('button', { name: 'Get text' }))[0];
|
|
714
|
-
expect((button as HTMLButtonElement).disabled).toBe(false);
|
|
715
|
-
await user.click(button);
|
|
716
|
-
|
|
717
|
-
expect(asked).toHaveLength(1);
|
|
718
|
-
});
|
|
719
|
-
|
|
720
|
-
it('offers no such control on a row that HAS text', async () => {
|
|
721
|
-
const { api } = tenant();
|
|
722
|
-
render(<LibraryPage api={api} scope={SCOPE} pageSize={50} />);
|
|
723
|
-
|
|
724
|
-
const row = (await screen.findByText('Rate card 2026')).closest('div.rounded-lg')!;
|
|
725
|
-
expect(within(row as HTMLElement).queryByRole('button', { name: 'Get text' })).toBeNull();
|
|
623
|
+
// Sources stay; no folder row and no disclosure is ever drawn.
|
|
624
|
+
expect(screen.queryByRole('button', { name: /^Expand / })).toBeNull();
|
|
726
625
|
});
|
|
727
626
|
});
|
|
@@ -26,9 +26,7 @@
|
|
|
26
26
|
* BOTH spellings and both spellings are exercised here.
|
|
27
27
|
*/
|
|
28
28
|
import { describe, expect, it } from 'vitest';
|
|
29
|
-
import { render, screen } from '@testing-library/react';
|
|
30
29
|
|
|
31
|
-
import { LibraryPage } from '../components/pages/LibraryPage';
|
|
32
30
|
import { createCorpusApi } from '../corpus/client';
|
|
33
31
|
import type { CorpusHttp } from '../corpus/client';
|
|
34
32
|
import { FIXTURE_ORG } from '../corpus/fixtures';
|
|
@@ -222,22 +220,3 @@ describe('listSources — it tried and it failed', () => {
|
|
|
222
220
|
expect(source.detail).toBe('Connected, but nothing has arrived yet.');
|
|
223
221
|
});
|
|
224
222
|
});
|
|
225
|
-
|
|
226
|
-
describe('the Library strip, rendered', () => {
|
|
227
|
-
/**
|
|
228
|
-
* The bug was VISIBLE, so one assertion is made where the reader would have
|
|
229
|
-
* seen it: the strip prints `synced {relative(lastSyncedAt)}`, and a
|
|
230
|
-
* never-synced connection with a freshly verified key used to render "synced
|
|
231
|
-
* 5 min ago" over an empty corpus.
|
|
232
|
-
*/
|
|
233
|
-
it('does not report a never-synced source as recently synced', async () => {
|
|
234
|
-
const http = httpOver([{ ...CONNECTED, last_checked_at: FIVE_MINUTES_AGO }]);
|
|
235
|
-
const api = createCorpusApi({ http, scope: SCOPE });
|
|
236
|
-
|
|
237
|
-
render(<LibraryPage api={api} scope={SCOPE} />);
|
|
238
|
-
|
|
239
|
-
expect(await screen.findByRole('cell', { name: 'Waiting for first sync' })).toBeInTheDocument();
|
|
240
|
-
expect(screen.getByRole('cell', { name: 'Never' })).toBeInTheDocument();
|
|
241
|
-
expect(screen.queryByText(/just now|\d+ min ago/)).not.toBeInTheDocument();
|
|
242
|
-
});
|
|
243
|
-
});
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* "the browser filtered it" is a detectable, and failing, outcome.
|
|
14
14
|
*/
|
|
15
15
|
import { describe, expect, it, vi } from 'vitest';
|
|
16
|
-
import { render, screen, waitFor, within } from '@testing-library/react';
|
|
16
|
+
import { configure, render, screen, waitFor, within } from '@testing-library/react';
|
|
17
17
|
import userEvent from '@testing-library/user-event';
|
|
18
18
|
|
|
19
19
|
import { AskPage } from '../components/pages/AskPage';
|
|
@@ -34,6 +34,9 @@ import type {
|
|
|
34
34
|
SourceFreshness,
|
|
35
35
|
} from '../corpus/types';
|
|
36
36
|
|
|
37
|
+
// The folders and counts arrive after the rows by design, so a loaded CI box needs more than the 1s default.
|
|
38
|
+
configure({ asyncUtilTimeout: 5000 });
|
|
39
|
+
|
|
37
40
|
const SCOPE = { orgId: FIXTURE_ORG };
|
|
38
41
|
|
|
39
42
|
function ownDocuments(): SourceDocument[] {
|
|
@@ -77,12 +80,10 @@ describe('LibraryPage — the only connected source is Dropbox', () => {
|
|
|
77
80
|
expect(await screen.findByText(/Master Services Agreement/)).toBeInTheDocument();
|
|
78
81
|
expect(screen.getAllByText('Dropbox').length).toBeGreaterThan(0);
|
|
79
82
|
|
|
80
|
-
// The
|
|
81
|
-
expect(screen.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
expect(screen.getByRole('cell', { name: 'Stale' })).toBeInTheDocument();
|
|
85
|
-
expect(screen.getByRole('cell', { name: /\d+[hd] ago/ })).toBeInTheDocument();
|
|
83
|
+
// The tree is DATA — Dropbox is a node because the source exists, with its count.
|
|
84
|
+
expect(await screen.findByRole('button', { name: /Dropbox/ })).toBeInTheDocument();
|
|
85
|
+
// Connector health is the Sources table's job: no freshness cards here.
|
|
86
|
+
expect(screen.queryByRole('cell', { name: 'Stale' })).not.toBeInTheDocument();
|
|
86
87
|
|
|
87
88
|
// Nothing in the chrome assumes a meeting.
|
|
88
89
|
expect(screen.queryByText(/transcript/i)).not.toBeInTheDocument();
|
|
@@ -146,7 +147,6 @@ describe('LibraryPage — filtering and paging are SERVER round trips', () => {
|
|
|
146
147
|
|
|
147
148
|
await screen.findByText('All documents');
|
|
148
149
|
await user.type(screen.getByRole('searchbox'), 'renewal');
|
|
149
|
-
await user.click(screen.getByRole('button', { name: 'Search' }));
|
|
150
150
|
|
|
151
151
|
await waitFor(() => expect(queries.some((query) => query.search === 'renewal')).toBe(true));
|
|
152
152
|
});
|
|
@@ -161,11 +161,11 @@ describe('LibraryPage — filtering and paging are SERVER round trips', () => {
|
|
|
161
161
|
});
|
|
162
162
|
render(<LibraryPage api={api} scope={SCOPE} pageSize={2} />);
|
|
163
163
|
|
|
164
|
-
await screen.findByText(/
|
|
165
|
-
await user.click(screen.getByRole('button', { name: 'Next' }));
|
|
164
|
+
await screen.findByText(/1-2 of \d+/);
|
|
165
|
+
await user.click(screen.getByRole('button', { name: 'Next page' }));
|
|
166
166
|
|
|
167
167
|
await waitFor(() => expect(queries.some((query) => query.page === 2)).toBe(true));
|
|
168
|
-
expect(await screen.findByText(/
|
|
168
|
+
expect(await screen.findByText(/3-4 of \d+/)).toBeInTheDocument();
|
|
169
169
|
});
|
|
170
170
|
|
|
171
171
|
it('returns to page 1 when a filter changes', async () => {
|
|
@@ -178,11 +178,11 @@ describe('LibraryPage — filtering and paging are SERVER round trips', () => {
|
|
|
178
178
|
});
|
|
179
179
|
render(<LibraryPage api={api} scope={SCOPE} pageSize={2} />);
|
|
180
180
|
|
|
181
|
-
await screen.findByText(/
|
|
182
|
-
await user.click(screen.getByRole('button', { name: 'Next' }));
|
|
183
|
-
await screen.findByText(/
|
|
181
|
+
await screen.findByText(/1-2 of \d+/);
|
|
182
|
+
await user.click(screen.getByRole('button', { name: 'Next page' }));
|
|
183
|
+
await screen.findByText(/3-4 of \d+/);
|
|
184
184
|
|
|
185
|
-
await user.
|
|
185
|
+
await user.click(await screen.findByRole('button', { name: /Dropbox/ }));
|
|
186
186
|
|
|
187
187
|
// Page 3 of the old result set is not page 3 of the new one; keeping it
|
|
188
188
|
// silently renders an empty list over a filter that worked.
|
|
@@ -210,7 +210,6 @@ describe('LibraryPage — filtering and paging are SERVER round trips', () => {
|
|
|
210
210
|
|
|
211
211
|
await screen.findByText('All documents');
|
|
212
212
|
await user.type(screen.getByRole('searchbox'), 'renewal');
|
|
213
|
-
await user.click(screen.getByRole('button', { name: 'Search' }));
|
|
214
213
|
|
|
215
214
|
expect(await screen.findByText(/does not filter by search yet/)).toBeInTheDocument();
|
|
216
215
|
});
|
|
@@ -235,9 +234,9 @@ describe('LibraryPage — the nothings', () => {
|
|
|
235
234
|
}],
|
|
236
235
|
});
|
|
237
236
|
render(<LibraryPage api={api} scope={SCOPE} />);
|
|
238
|
-
//
|
|
239
|
-
expect(await screen.
|
|
240
|
-
expect(screen.
|
|
237
|
+
// An empty corpus under a connected source says it has not arrived (the Sources table says why), and the source is in the tree.
|
|
238
|
+
expect(await screen.findByText(/Nothing has arrived yet/)).toBeInTheDocument();
|
|
239
|
+
expect(await screen.findByRole('button', { name: /Google Drive/ })).toBeInTheDocument();
|
|
241
240
|
});
|
|
242
241
|
|
|
243
242
|
it('renders a record that arrived with no text at all', async () => {
|
|
@@ -283,9 +282,9 @@ describe('LibraryPage — a record from another workspace never renders', () =>
|
|
|
283
282
|
render(<LibraryPage api={api} scope={SCOPE} pageSize={3} />);
|
|
284
283
|
|
|
285
284
|
expect(await screen.findByRole('alert')).toHaveTextContent(/belonging to another workspace/);
|
|
286
|
-
await user.click(screen.getByRole('button', { name: 'Next' }));
|
|
285
|
+
await user.click(screen.getByRole('button', { name: 'Next page' }));
|
|
287
286
|
|
|
288
|
-
await screen.findByText(/
|
|
287
|
+
await screen.findByText(/4-6 of/);
|
|
289
288
|
expect(screen.getByRole('alert')).toHaveTextContent(/belonging to another workspace/);
|
|
290
289
|
});
|
|
291
290
|
|
|
@@ -55,9 +55,7 @@
|
|
|
55
55
|
* ones. Not a denylist of connector keys — `status` is data the server writes.
|
|
56
56
|
*/
|
|
57
57
|
import { describe, expect, it } from 'vitest';
|
|
58
|
-
import { render, screen, within } from '@testing-library/react';
|
|
59
58
|
|
|
60
|
-
import { LibraryPage } from '../components/pages/LibraryPage';
|
|
61
59
|
import { createCorpusApi } from '../corpus/client';
|
|
62
60
|
import type { CorpusHttp } from '../corpus/client';
|
|
63
61
|
import { FIXTURE_ORG } from '../corpus/fixtures';
|
|
@@ -212,36 +210,6 @@ describe('listSources — a disconnected vendor is not a source', () => {
|
|
|
212
210
|
});
|
|
213
211
|
});
|
|
214
212
|
|
|
215
|
-
describe('the Library strip, rendered', () => {
|
|
216
|
-
it('draws a card for the member’s own source and none for the disconnected one', async () => {
|
|
217
|
-
const { http } = recorderOver([SHARED_GRANOLA, MY_FATHOM, DISCONNECTED_DROPBOX]);
|
|
218
|
-
const api = createCorpusApi({ http, scope: SCOPE });
|
|
219
|
-
|
|
220
|
-
render(<LibraryPage api={api} scope={SCOPE} />);
|
|
221
|
-
|
|
222
|
-
// Scoped to the strip itself: `listSources` also feeds the source filter's
|
|
223
|
-
// options, so an unscoped query would match the same vendor twice and say
|
|
224
|
-
// nothing about which surface it appeared on.
|
|
225
|
-
const strip = within(await screen.findByRole('region', { name: 'Source freshness' }));
|
|
226
|
-
expect(strip.getByText('Fathom')).toBeInTheDocument();
|
|
227
|
-
expect(strip.getByText('Granola')).toBeInTheDocument();
|
|
228
|
-
expect(strip.queryByText('Dropbox')).not.toBeInTheDocument();
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
it('does not blame a disconnected vendor in the empty state', async () => {
|
|
232
|
-
// `EmptyState` names every source whose status is `error`. A vendor nobody
|
|
233
|
-
// is connected to must not be reported as "failing to sync" — the action
|
|
234
|
-
// that sentence asks for (go fix the connection) is the wrong action.
|
|
235
|
-
const { http } = recorderOver([DISCONNECTED_DROPBOX]);
|
|
236
|
-
const api = createCorpusApi({ http, scope: SCOPE });
|
|
237
|
-
|
|
238
|
-
render(<LibraryPage api={api} scope={SCOPE} />);
|
|
239
|
-
|
|
240
|
-
expect(await screen.findByText(/Nothing has been pulled in yet/i)).toBeInTheDocument();
|
|
241
|
-
expect(screen.queryByText(/Dropbox/)).not.toBeInTheDocument();
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
|
|
245
213
|
/**
|
|
246
214
|
* THE COUNT ON THE CARD IS A CORPUS FACT, AND IT WAS NEVER READ
|
|
247
215
|
* (bd startsim-jevtu RED, first filed as startsim-o0o6o.1).
|
|
@@ -436,34 +404,3 @@ describe('listSources — the record count is counted, not read off the connecti
|
|
|
436
404
|
expect(sources.map((source) => source.documentCount)).toEqual([null, null]);
|
|
437
405
|
});
|
|
438
406
|
});
|
|
439
|
-
|
|
440
|
-
describe('the Library strip, counting', () => {
|
|
441
|
-
const strip = async () =>
|
|
442
|
-
within(await screen.findByRole('region', { name: 'Source freshness' }));
|
|
443
|
-
|
|
444
|
-
it('prints the count the corpus actually holds', async () => {
|
|
445
|
-
const { http } = corpusOver([SHARED_GRANOLA, SHARED_N8N], TANDEM_COUNTS);
|
|
446
|
-
render(<LibraryPage api={createCorpusApi({ http, scope: SCOPE })} scope={SCOPE} />);
|
|
447
|
-
|
|
448
|
-
expect((await strip()).getByRole('cell', { name: '208' })).toBeInTheDocument();
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
it('says a source has delivered nothing, in words', async () => {
|
|
452
|
-
const { http } = corpusOver([SHARED_GRANOLA, SHARED_N8N], TANDEM_COUNTS);
|
|
453
|
-
render(<LibraryPage api={createCorpusApi({ http, scope: SCOPE })} scope={SCOPE} />);
|
|
454
|
-
|
|
455
|
-
expect((await strip()).getByRole('cell', { name: '0' })).toBeInTheDocument();
|
|
456
|
-
});
|
|
457
|
-
|
|
458
|
-
it('prints no number at all when the count is unknown', async () => {
|
|
459
|
-
const { http } = corpusOver([SHARED_GRANOLA, SHARED_N8N], TANDEM_COUNTS, { reports: 'none' });
|
|
460
|
-
render(<LibraryPage api={createCorpusApi({ http, scope: SCOPE })} scope={SCOPE} />);
|
|
461
|
-
|
|
462
|
-
const shown = await strip();
|
|
463
|
-
// The freshness half of the card is unaffected — a count it could not get
|
|
464
|
-
// costs the reader the count, not the sentence.
|
|
465
|
-
expect(shown.getByRole('columnheader', { name: 'Last sync' })).toBeInTheDocument();
|
|
466
|
-
expect(shown.queryByRole('cell', { name: '208' })).not.toBeInTheDocument();
|
|
467
|
-
expect(shown.getAllByRole('cell', { name: '—' }).length).toBeGreaterThan(0);
|
|
468
|
-
});
|
|
469
|
-
});
|
|
@@ -28,9 +28,7 @@
|
|
|
28
28
|
* is invisible until somebody's Library quietly lies.
|
|
29
29
|
*/
|
|
30
30
|
import { describe, expect, it } from 'vitest';
|
|
31
|
-
import { render, screen } from '@testing-library/react';
|
|
32
31
|
|
|
33
|
-
import { LibraryPage } from '../components/pages/LibraryPage';
|
|
34
32
|
import { createCorpusApi } from '../corpus/client';
|
|
35
33
|
import type { CorpusHttp } from '../corpus/client';
|
|
36
34
|
import { FIXTURE_ORG } from '../corpus/fixtures';
|
|
@@ -161,19 +159,3 @@ describe('listSources — the strip carries the reason central sends', () => {
|
|
|
161
159
|
expect(granola.detail).toBeUndefined();
|
|
162
160
|
});
|
|
163
161
|
});
|
|
164
|
-
|
|
165
|
-
describe('the Library strip, rendered', () => {
|
|
166
|
-
it('says a failing source is not syncing in plain words and never prints the vendor text', async () => {
|
|
167
|
-
// The adapter still carries `lastError` for any surface that wants it, but the sources table
|
|
168
|
-
// is for reading at a glance: plain words, no raw error (bd startsim-c93vd).
|
|
169
|
-
render(
|
|
170
|
-
<LibraryPage
|
|
171
|
-
api={createCorpusApi({ http: httpOver([TANDEM_GRANOLA]), scope: SCOPE })}
|
|
172
|
-
scope={SCOPE}
|
|
173
|
-
/>,
|
|
174
|
-
);
|
|
175
|
-
|
|
176
|
-
expect(await screen.findByRole('cell', { name: 'Not syncing' })).toBeInTheDocument();
|
|
177
|
-
expect(screen.queryByText(/262144-byte cap/)).not.toBeInTheDocument();
|
|
178
|
-
});
|
|
179
|
-
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { DATE_FILTERS, dateAfter, dateKeyOf, emptyColumns, folderCell, orderOf, typeLabel, typeOptions, whoText } from '../components/pages/library/library-model';
|
|
4
|
+
import type { SourceDocument } from '../corpus/types';
|
|
5
|
+
|
|
6
|
+
const NOW = Date.parse('2026-11-20T12:00:00Z');
|
|
7
|
+
|
|
8
|
+
describe('Library table rules', () => {
|
|
9
|
+
it('words a subtype the source gave and shows a dash for none', () => {
|
|
10
|
+
expect(typeLabel('voice_note')).toBe('Voice note');
|
|
11
|
+
expect(typeLabel('meeting')).toBe('Meeting');
|
|
12
|
+
expect(typeLabel('purchase_order')).toBe('Purchase order');
|
|
13
|
+
expect(typeLabel(undefined)).toBe('—');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('offers only the types seen, plus the one chosen, after "All types"', () => {
|
|
17
|
+
expect(typeOptions(['meeting', 'document'], undefined).map((o) => o.value)).toEqual(['', 'document', 'meeting']);
|
|
18
|
+
expect(typeOptions(['meeting'], 'email').map((o) => o.value)).toEqual(['', 'email', 'meeting']);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('turns a Date option into an instant from an explicit clock', () => {
|
|
22
|
+
expect(dateAfter('', NOW)).toBeUndefined();
|
|
23
|
+
expect(dateAfter('7', NOW)).toBe('2026-11-13T12:00:00.000Z');
|
|
24
|
+
expect(dateAfter('year', NOW)).toBe('2026-01-01T00:00:00Z');
|
|
25
|
+
expect(dateKeyOf(dateAfter('30', NOW), NOW)).toBe('30');
|
|
26
|
+
expect(dateKeyOf(undefined, NOW)).toBe('');
|
|
27
|
+
expect(DATE_FILTERS[0].label).toBe('Any date');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('sorts only by date, newest or oldest first, server-side', () => {
|
|
31
|
+
expect(orderOf(null)).toBeUndefined();
|
|
32
|
+
expect(orderOf({ key: 'title', dir: 'asc' })).toBeUndefined();
|
|
33
|
+
expect(orderOf({ key: 'date', dir: 'asc' })).toBe('oldest');
|
|
34
|
+
expect(orderOf({ key: 'date', dir: 'desc' })).toBe('recent');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('shortens who, and dashes a record with nobody', () => {
|
|
38
|
+
const p = (name: string) => ({ id: name, name });
|
|
39
|
+
expect(whoText([])).toBe('—');
|
|
40
|
+
expect(whoText([p('Ada'), p('Grace')])).toBe('Ada, Grace');
|
|
41
|
+
expect(whoText([p('Ada'), p('Grace'), p('Linus'), p('Ken')])).toBe('Ada, Grace +2');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('shows the container name, or a dash for a source with no folders', () => {
|
|
45
|
+
expect(folderCell({ folder: '/Design/Brand' } as SourceDocument)).toEqual({ label: 'Brand', full: '/Design/Brand' });
|
|
46
|
+
expect(folderCell({} as SourceDocument)).toEqual({ label: '—', full: '' });
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('names the columns with nothing in them, and waits on the people before judging Who', () => {
|
|
50
|
+
const bare = { participants: [] } as unknown as SourceDocument;
|
|
51
|
+
expect([...emptyColumns([bare], true)].sort()).toEqual(['folder', 'type', 'who']);
|
|
52
|
+
expect([...emptyColumns([bare], false)].sort()).toEqual(['folder', 'type']);
|
|
53
|
+
expect(emptyColumns([{ participants: [{ id: '1', name: 'A' }], subtype: 'x', folder: '/f' } as unknown as SourceDocument], true).size).toBe(0);
|
|
54
|
+
expect(emptyColumns([], true).size).toBe(0);
|
|
55
|
+
});
|
|
56
|
+
});
|