forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettingsSections.test.ts
More file actions
75 lines (63 loc) · 2.35 KB
/
Copy pathsettingsSections.test.ts
File metadata and controls
75 lines (63 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { describe, expect, it } from 'vitest';
import {
CLAUDE_CONNECTOR_OAUTH,
SECTION_INFO,
SETTINGS_SECTIONS,
SIGNED_OUT_DESTINATION,
isSettingsSectionId,
} from '@/lib/settingsSections';
describe('CLAUDE_CONNECTOR_OAUTH', () => {
it('uses the registered public PKCE client without a secret', () => {
expect(CLAUDE_CONNECTOR_OAUTH).toEqual({
clientId: 'omi-claude-prod',
clientSecret: '',
});
});
});
describe('SIGNED_OUT_DESTINATION', () => {
it('uses a registered client route after authentication ends', () => {
expect(SIGNED_OUT_DESTINATION).toBe('/login');
});
});
describe('SETTINGS_SECTIONS', () => {
it('includes privacy, which shipped with no nav entry pointing at it', () => {
expect(SETTINGS_SECTIONS.map((section) => section.id)).toContain('privacy');
});
it('gives every section a label and a description for the nav and header', () => {
for (const section of SETTINGS_SECTIONS) {
expect(section.label.length).toBeGreaterThan(0);
expect(section.description.length).toBeGreaterThan(0);
}
});
it('has no integrations section — connected services live on /connectors', () => {
expect(SETTINGS_SECTIONS.map((section) => section.id)).not.toContain('integrations');
});
it('has one merged account section rather than separate profile and account', () => {
const ids = SETTINGS_SECTIONS.map((section) => section.id);
expect(ids).toContain('account');
expect(ids).not.toContain('profile');
});
it('has no duplicate ids', () => {
const ids = SETTINGS_SECTIONS.map((section) => section.id);
expect(new Set(ids).size).toBe(ids.length);
});
});
describe('SECTION_INFO', () => {
it('covers exactly the declared sections', () => {
expect(Object.keys(SECTION_INFO).sort()).toEqual(
SETTINGS_SECTIONS.map((section) => section.id).sort(),
);
});
});
describe('isSettingsSectionId', () => {
it('accepts a declared section', () => {
expect(isSettingsSectionId('privacy')).toBe(true);
});
it('rejects anything else, so ?section= cannot select a missing page', () => {
expect(isSettingsSectionId('nope')).toBe(false);
expect(isSettingsSectionId('integrations')).toBe(false);
expect(isSettingsSectionId('profile')).toBe(false);
expect(isSettingsSectionId('')).toBe(false);
expect(isSettingsSectionId('__proto__')).toBe(false);
});
});