Also reset engineName and engineNotFound on clearEngine (#87259)

This commit is contained in:
Constance 2021-01-06 10:04:58 -08:00 committed by GitHub
parent bd91c16036
commit 8c74bb3345
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View file

@ -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 });
@ -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', () => {

View file

@ -64,12 +64,14 @@ export const EngineLogic = kea<MakeLogicType<EngineValues, EngineActions>>({
'',
{
setEngineName: (_, { engineName }) => engineName,
clearEngine: () => '',
},
],
engineNotFound: [
false,
{
setEngineNotFound: (_, { notFound }) => notFound,
clearEngine: () => false,
},
],
},