Add OAuth-protected MCP server with generated API client packages
This commit is contained in:
1 parent
26e236c95c
commit
65bf19e067
235 files changed
+33755
-3199
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { describe, expect, test } from 'vitest';
|
||||
import { resolveClientOptions } from './stdio';
|
||||
|
||||
describe('resolveClientOptions', () => {
|
||||
test('appends /api to a self-hosted instance URL', () => {
|
||||
expect(
|
||||
resolveClientOptions({ UMAMI_URL: 'https://analytics.example.com/', UMAMI_API_TOKEN: 't' }),
|
||||
).toEqual({ baseUrl: 'https://analytics.example.com/api', token: 't', apiKey: undefined });
|
||||
});
|
||||
|
||||
test('uses UMAMI_API_URL verbatim', () => {
|
||||
expect(
|
||||
resolveClientOptions({ UMAMI_API_URL: 'https://api.umami.is/v1', UMAMI_API_KEY: 'k' }),
|
||||
).toEqual({ baseUrl: 'https://api.umami.is/v1', token: undefined, apiKey: 'k' });
|
||||
});
|
||||
|
||||
test('defaults to Cloud when only an API key is provided', () => {
|
||||
expect(resolveClientOptions({ UMAMI_API_KEY: 'k' }).baseUrl).toBeUndefined();
|
||||
});
|
||||
|
||||
test('requires credentials', () => {
|
||||
expect(() => resolveClientOptions({})).toThrow(/UMAMI_API_TOKEN/);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user