Publish curated ITWorx-Pulse source from 0e0633c8ac91cb71312a26837f791035a78d81b8
Public source validation / validate (push) Failing after 2m10s
Public source validation / validate (push) Failing after 2m10s
This commit is contained in:
1 parent
a4956c2af9
commit
db8093b608
88 files changed
+3685
-469
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { fallbackWidgetCatalog, isWidgetType, readWidgetCatalog, widgetLabel, widgetTypes } from '../../src/widgetCatalog';
|
||||
|
||||
afterEach(() => vi.unstubAllGlobals());
|
||||
|
||||
describe('widget catalog client', () => {
|
||||
it('keeps one bounded fourteen-type catalog including query inspector', () => {
|
||||
expect(widgetTypes).toHaveLength(14);
|
||||
expect(new Set(widgetTypes).size).toBe(14);
|
||||
expect(fallbackWidgetCatalog).toHaveLength(14);
|
||||
expect(widgetLabel('query-inspector')).toBe('Query-inspecteur');
|
||||
expect(isWidgetType('made-up')).toBe(false);
|
||||
});
|
||||
|
||||
it('normalizes the existing Go catalog shape and ignores unknown entries', async () => {
|
||||
vi.stubGlobal('fetch', vi.fn(async () => new Response(JSON.stringify({ items: [
|
||||
{ Type: 'stat', Capabilities: ['metrics'] }, { Type: 'made-up' }, { type: 'text', capabilities: ['safe-markdown'] },
|
||||
] }), { status: 200, headers: { 'Content-Type': 'application/json' } })));
|
||||
const catalog = await readWidgetCatalog();
|
||||
expect(catalog).toHaveLength(14);
|
||||
expect(catalog.find((item) => item.type === 'stat')?.capabilities).toEqual(['metrics']);
|
||||
expect(catalog.find((item) => item.type === 'text')?.capabilities).toEqual(['safe-markdown']);
|
||||
expect(catalog.some((item) => item.type === ('made-up' as never))).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user