-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathauth.test.ts
More file actions
64 lines (54 loc) · 1.71 KB
/
auth.test.ts
File metadata and controls
64 lines (54 loc) · 1.71 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
import type { UserAuthConfig } from '@inkeep/agents-core/auth';
import { describe, expect, it, vi } from 'vitest';
import { createAgentsApp } from '../index';
vi.mock('../../env', () => ({
env: {
INKEEP_AGENTS_API_URL: 'http://localhost:3002',
BETTER_AUTH_URL: 'http://localhost:3002',
BETTER_AUTH_SECRET: 'test-secret',
},
}));
vi.mock('../../data/db/manageDbClient', () => ({
default: {
select: vi.fn(),
insert: vi.fn(),
update: vi.fn(),
delete: vi.fn(),
},
}));
vi.mock('../../initialization', () => ({
initializeDefaultUser: vi.fn(),
}));
describe('Auth Integration', () => {
it('should create management app with auth enabled by default', () => {
const app = createAgentsApp();
expect(app).toBeDefined();
});
it('should create management app with custom auth config', () => {
const customAuthConfig: UserAuthConfig = {
ssoProviders: [],
};
const app = createAgentsApp({ auth: customAuthConfig });
expect(app).toBeDefined();
});
it('should handle auth disabled mode', () => {
vi.resetModules();
vi.doMock('../../env', () => ({
env: {
INKEEP_AGENTS_API_URL: 'http://localhost:3002',
},
}));
const app = createAgentsApp();
expect(app).toBeDefined();
});
it('should export createAuth0Provider helper', async () => {
const { createAuth0Provider } = await import('../index');
expect(createAuth0Provider).toBeDefined();
expect(typeof createAuth0Provider).toBe('function');
});
it('should export createOIDCProvider helper', async () => {
const { createOIDCProvider } = await import('../index');
expect(createOIDCProvider).toBeDefined();
expect(typeof createOIDCProvider).toBe('function');
});
});