Skip to content

Commit

Permalink
Also reset engineName and engineNotFound on clearEngine (#87259)
Browse files Browse the repository at this point in the history
  • Loading branch information
Constance authored Jan 6, 2021
1 parent bd91c16 commit 8c74bb3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,18 @@ describe('EngineLogic', () => {
});
});

describe('engineName', () => {
it('should be reset to an empty string', () => {
mount({ engineName: 'hello-world' });
EngineLogic.actions.clearEngine();

expect(EngineLogic.values).toEqual({
...DEFAULT_VALUES,
engineName: '',
});
});
});

describe('dataLoading', () => {
it('should be set to true', () => {
mount({ dataLoading: false });
Expand All @@ -147,6 +159,18 @@ describe('EngineLogic', () => {
});
});
});

describe('engineNotFound', () => {
it('should be set to false', () => {
mount({ engineNotFound: true });
EngineLogic.actions.clearEngine();

expect(EngineLogic.values).toEqual({
...DEFAULT_VALUES,
engineNotFound: false,
});
});
});
});

describe('initializeEngine', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ export const EngineLogic = kea<MakeLogicType<EngineValues, EngineActions>>({
'',
{
setEngineName: (_, { engineName }) => engineName,
clearEngine: () => '',
},
],
engineNotFound: [
false,
{
setEngineNotFound: (_, { notFound }) => notFound,
clearEngine: () => false,
},
],
},
Expand Down

0 comments on commit 8c74bb3

Please sign in to comment.