Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kdelemme committed Sep 26, 2023
1 parent ce855f8 commit 3f5bd11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { transformPartialUrlStateToFormState as transform } from './process_slo_

describe('Transform Partial URL State into partial State Form', () => {
describe('indicators', () => {
it('returns null when no indicator type is specified', () => {
expect(transform({ indicator: { params: { index: 'my-index' } } })).toEqual(null);
it("returns an empty '{}' when no indicator type is specified", () => {
expect(transform({ indicator: { params: { index: 'my-index' } } })).toEqual({});
});

it('handles partial APM Availability state', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ describe('SLO Edit Page', () => {

const history = createBrowserHistory();
history.push(
'/slos/create?_a=(name:%27prefilledSloName%27,indicator:(params:(environment:prod,service:cartService),type:sli.apm.transactionDuration))'
'/slos/create?_a=(indicator:(params:(environment:prod,service:cartService),type:sli.apm.transactionDuration))'
);
jest.spyOn(Router, 'useHistory').mockReturnValue(history);
jest
Expand Down Expand Up @@ -409,18 +409,14 @@ describe('SLO Edit Page', () => {
expect(screen.queryByTestId('sloForm')).toBeTruthy();

expect(screen.queryByTestId('sloEditFormIndicatorSection')).toBeTruthy();
// Show default values from the kql indicator
expect(screen.queryByTestId('sloFormIndicatorTypeSelect')).toHaveValue(
'sli.apm.transactionDuration'
);

expect(screen.queryByTestId('sloEditFormObjectiveSection')).toBeTruthy();
expect(screen.queryByTestId('sloEditFormDescriptionSection')).toBeTruthy();

expect(screen.queryByTestId('apmLatencyServiceSelector')).toHaveTextContent('cartService');
expect(screen.queryByTestId('apmLatencyEnvironmentSelector')).toHaveTextContent('prod');

expect(screen.queryByTestId('sloFormNameInput')).toHaveValue('prefilledSloName');
expect(screen.queryByTestId('sloEditFormObjectiveSection')).toBeFalsy();
expect(screen.queryByTestId('sloEditFormDescriptionSection')).toBeFalsy();
});
});

Expand Down

0 comments on commit 3f5bd11

Please sign in to comment.