forked from opensearch-project/dashboards-observability
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into remove-id-cache
Signed-off-by: Paul Sebastian <[email protected]>
- Loading branch information
Showing
27 changed files
with
1,129 additions
and
411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
.ppl-query-accordion { | ||
padding: $euiSizeS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
public/components/datasources/components/__tests__/acceleration_details_flyout.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { mount, configure } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import { AccelerationDetailsFlyout } from '../manage/accelerations/acceleration_details_flyout'; | ||
import * as coreRefsModule from '../../../../framework/core_refs'; | ||
|
||
jest.mock('../../../../framework/core_refs', () => { | ||
const actualModule = jest.requireActual('../../../../framework/core_refs'); | ||
return { | ||
coreRefs: { | ||
...actualModule.coreRefs, | ||
dslService: { | ||
fetchFields: jest.fn().mockResolvedValue({ data: 'mockFieldData' }), | ||
fetchSettings: jest.fn().mockResolvedValue({ data: 'mockSettingsData' }), | ||
fetchIndices: jest.fn().mockResolvedValue({ data: 'mockIndexData' }), | ||
}, | ||
}, | ||
}; | ||
}); | ||
|
||
jest.mock('../../../../framework/core_refs', () => { | ||
return { | ||
coreRefs: { | ||
dslService: { | ||
fetchFields: jest.fn().mockResolvedValue({ data: 'mockFieldData' }), | ||
fetchSettings: jest.fn().mockResolvedValue({ data: 'mockSettingsData' }), | ||
fetchIndices: jest.fn().mockResolvedValue({ | ||
status: 'fulfilled', | ||
action: 'getIndexInfo', | ||
data: [ | ||
{ | ||
health: 'yellow', | ||
status: 'open', | ||
index: 'flint_mys3_default_http_count_view', | ||
uuid: 'VImREbK4SMqJ-i6hSB84eQ', | ||
pri: '1', | ||
rep: '1', | ||
'docs.count': '0', | ||
'docs.deleted': '0', | ||
'store.size': '208b', | ||
'pri.store.size': '208b', | ||
}, | ||
], | ||
}), | ||
}, | ||
}, | ||
}; | ||
}); | ||
|
||
const mockAcceleration = { | ||
index: 'mockIndex', | ||
dataSourceName: 'mockDataSource', | ||
acceleration: { | ||
flintIndexName: 'testIndex', | ||
}, | ||
}; | ||
|
||
configure({ adapter: new Adapter() }); | ||
|
||
describe('AccelerationDetailsFlyout Component Tests', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('fetches acceleration details on mount', async () => { | ||
mount(<AccelerationDetailsFlyout acceleration={mockAcceleration} />); | ||
|
||
expect(coreRefsModule.coreRefs.dslService!.fetchFields).toHaveBeenCalledWith('testIndex'); | ||
expect(coreRefsModule.coreRefs.dslService!.fetchSettings).toHaveBeenCalledWith('testIndex'); | ||
expect(coreRefsModule.coreRefs.dslService!.fetchIndices).toHaveBeenCalledWith('testIndex'); | ||
}); | ||
|
||
it('switches tabs correctly', async () => { | ||
const wrapper = mount(<AccelerationDetailsFlyout acceleration={mockAcceleration} />); | ||
await new Promise(setImmediate); | ||
wrapper.update(); | ||
|
||
const schemaTabExists = wrapper.find('EuiTab').someWhere((node) => node.text() === 'Schema'); | ||
expect(schemaTabExists).toBeTruthy(); | ||
|
||
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); | ||
|
||
// TODO: SQL DEFINATION TAB CHECK | ||
}); | ||
}); |
Oops, something went wrong.