Skip to content

Commit

Permalink
Use string values for EngineTypes instead of int (#94823) (#95165)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Byron Hulcher <byronhulcher@gmail.com>
  • Loading branch information
kibanamachine and byronhulcher authored Mar 23, 2021
1 parent afa16c0 commit bc0e4c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { Schema, SchemaConflicts, IIndexingStatus } from '../../../shared/types'
import { ApiToken } from '../credentials/types';

export enum EngineTypes {
default,
indexed,
meta,
default = 'default',
indexed = 'indexed',
meta = 'meta',
}
export interface Engine {
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,21 @@ describe('EnginesLogic', () => {
it('should call loadEngines if engine.type === default', () => {
jest.spyOn(EnginesLogic.actions, 'loadEngines');

EnginesLogic.actions.onDeleteEngineSuccess({ ...MOCK_ENGINE, type: EngineTypes.default });
EnginesLogic.actions.onDeleteEngineSuccess({
...MOCK_ENGINE,
type: 'default' as EngineTypes.default,
});

expect(EnginesLogic.actions.loadEngines).toHaveBeenCalled();
});

it('should call loadMetaEngines if engine.type === meta', () => {
jest.spyOn(EnginesLogic.actions, 'loadMetaEngines');

EnginesLogic.actions.onDeleteEngineSuccess({ ...MOCK_ENGINE, type: EngineTypes.meta });
EnginesLogic.actions.onDeleteEngineSuccess({
...MOCK_ENGINE,
type: 'meta' as EngineTypes.meta,
});

expect(EnginesLogic.actions.loadMetaEngines).toHaveBeenCalled();
});
Expand Down

0 comments on commit bc0e4c7

Please sign in to comment.