Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Yuanqi(Ella) Zhu <[email protected]>
  • Loading branch information
zhyuanqi committed Mar 19, 2024
1 parent 4d0bb20 commit 2e66cf9
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const notFoundIdentifier = '[data-test-subj="dataSourceNotFound"]';

describe('Datasource Management: Edit Datasource Wizard', () => {
const mockedContext = mockManagementPlugin.createDataSourceManagementContext();
const uiSettings = mockedContext.uiSettings;
mockedContext.authenticationMethodRegistery.registerAuthenticationMethod(
noAuthCredentialAuthMethod
);
Expand Down Expand Up @@ -125,6 +126,16 @@ describe('Datasource Management: Edit Datasource Wizard', () => {
component.update();
expect(utils.updateDataSourceById).toHaveBeenCalled();
});
test('should set default data source', async () => {
spyOn(uiSettings, 'set').and.returnValue({});
await act(async () => {
// @ts-ignore
await component.find(formIdentifier).first().prop('onSetDefaultDataSource')(
mockDataSourceAttributesWithAuth
);
});
expect(uiSettings.set).toHaveBeenCalled();
});
test('should delete datasource successfully', async () => {
spyOn(utils, 'deleteDataSourceById').and.returnValue({});

Expand Down

0 comments on commit 2e66cf9

Please sign in to comment.