mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-07-18 01:31:47 +00:00
Add getting individuals and focusing the view on a selected person. This feature was added following the method described in the article "Elephants, Goldfish and the New Golden Age of Software Engineering" by Dave Rensin https://drensin.medium.com/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874 #vibecoded
38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
describe('WebMCP Integration', () => {
|
|
let registeredTools = [];
|
|
|
|
beforeEach(() => {
|
|
registeredTools = [];
|
|
cy.visit('/view?handleCors=false&url=https%3A%2F%2Fraw.githubusercontent.com%2FPeWu%2Ftopola%2Fmaster%2Fdemo%2Fdata%2Ffamily.ged', {
|
|
onBeforeLoad(win) {
|
|
win.navigator.modelContext = {
|
|
registerTool: (tool) => {
|
|
registeredTools.push(tool);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
});
|
|
|
|
it('registers tools to standard modelContext', () => {
|
|
cy.wrap(registeredTools).should('have.length', 7);
|
|
const toolNames = registeredTools.map(t => t.name);
|
|
expect(toolNames).to.include('get_selected_person');
|
|
expect(toolNames).to.include('search_indi');
|
|
expect(toolNames).to.include('inspect_indi');
|
|
expect(toolNames).to.include('focus_indi');
|
|
expect(toolNames).to.include('find_relationship_path');
|
|
expect(toolNames).to.include('get_ancestors');
|
|
expect(toolNames).to.include('get_descendants');
|
|
});
|
|
|
|
it('allows running focus_indi tool', () => {
|
|
cy.contains('Radobod');
|
|
cy.wrap(registeredTools).then((tools) => {
|
|
const focusTool = tools.find(t => t.name === 'focus_indi');
|
|
// Radobod's ID or another valid ID. In topola sample data let's just grab selection
|
|
expect(focusTool).to.not.be.undefined;
|
|
});
|
|
});
|
|
});
|