Skip to content

Commit b70c1cb

Browse files
committed
add tests
1 parent 32e8532 commit b70c1cb

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

packages/mcp-server/src/tools/get_component_api/get_component_api.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,15 @@ test('handler: Dialog has applyFocus method extracted from DomRef', (t) => {
7070
const applyFocus = result.methods.find((m: { name: string }) => m.name === 'applyFocus');
7171
t.truthy(applyFocus, 'Dialog should have applyFocus method');
7272
});
73+
74+
test('handler: abstract component is flagged with isAbstract', (t) => {
75+
// Tab is marked @abstract (_ui5abstract in the CEM) -> isAbstract set in enrichWithCem
76+
const result = getStructured(handler({ componentName: 'Tab' }));
77+
t.true(result.isAbstract, 'Tab should be flagged isAbstract: true');
78+
});
79+
80+
test('handler: non-abstract component does not set isAbstract', (t) => {
81+
// Button is a regular self-rendering component -> flag should be absent/falsy
82+
const result = getStructured(handler({ componentName: 'Button' }));
83+
t.falsy(result.isAbstract, 'Button should not be flagged as abstract');
84+
});

packages/mcp-server/src/tools/get_documentation/get_documentation.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,15 @@ test('handler: section + query together returns error', (t) => {
5454
const result = getText(handler({ section: 'Getting Started', query: 'styling' }));
5555
t.true(result.includes('either'));
5656
});
57+
58+
test('handler: search finds the Testing section', (t) => {
59+
const result = getText(handler({ query: 'testing' }));
60+
t.true(result.includes('Testing'));
61+
});
62+
63+
test('handler: Testing section lookup with fetchContent loads bundled content', (t) => {
64+
// docs/*.mdx files are gitignored (generated by bundle:docs)
65+
const result = getText(handler({ section: 'Knowledge Base > Testing', fetchContent: true }));
66+
t.true(result.includes('Testing'));
67+
t.false(result.includes('bundled docs may need to be regenerated'));
68+
});

0 commit comments

Comments
 (0)