Skip to content

Commit

Permalink
Added test for accleration details flyout with MDSId
Browse files Browse the repository at this point in the history
Signed-off-by: sumukhswamy <[email protected]>
  • Loading branch information
sumukhswamy committed Feb 19, 2025
1 parent 5b3e9ad commit f227c2a
Showing 1 changed file with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,56 @@ describe('AccelerationDetailsFlyout Component Tests', () => {
expect(coreRefsModule.coreRefs.dslService!.fetchIndices).toHaveBeenCalledWith('testIndex', '');
});

it('fetches acceleration details with specific mdsId', async () => {
mount(
<AccelerationDetailsFlyout
index="mockIndex"
acceleration={mockAcceleration}
dataSourceName="mockDataSource"
dataSourceMDSId="746ebe20-ee4a-11ef-823a-bd0a7d9fd697"
/>
);

expect(coreRefsModule.coreRefs.dslService!.fetchFields).toHaveBeenCalledWith(
'testIndex',
'746ebe20-ee4a-11ef-823a-bd0a7d9fd697'
);
expect(coreRefsModule.coreRefs.dslService!.fetchSettings).toHaveBeenCalledWith(
'testIndex',
'746ebe20-ee4a-11ef-823a-bd0a7d9fd697'
);
expect(coreRefsModule.coreRefs.dslService!.fetchIndices).toHaveBeenCalledWith(
'testIndex',
'746ebe20-ee4a-11ef-823a-bd0a7d9fd697'
);
});

it('renders the correct tab content on tab switch', async () => {
const wrapper = mount(
<AccelerationDetailsFlyout
index="mockIndex"
acceleration={mockAcceleration}
dataSourceName="mockDataSource"
/>
);
await new Promise(setImmediate);
wrapper.update();

const detailsTab = wrapper.find('EuiTab').filterWhere((node) => node.text() === 'Details');
detailsTab.simulate('click');
await new Promise(setImmediate);
wrapper.update();

expect(wrapper.find('AccelerationDetailsTab').exists()).toBe(true);

const schemaTab = wrapper.find('EuiTab').filterWhere((node) => node.text() === 'Schema');
schemaTab.simulate('click');
await new Promise(setImmediate);
wrapper.update();

expect(wrapper.find('AccelerationSchemaTab').exists()).toBe(true);
});

it('switches tabs correctly', async () => {
const wrapper = mount(
<AccelerationDetailsFlyout
Expand Down

0 comments on commit f227c2a

Please sign in to comment.