First refactor of redux tests to avoid covering RTK implementation details

This commit is contained in:
Alejandro Celaya
2023-03-18 12:09:38 +01:00
parent a6d000714b
commit 9cefdb7977
4 changed files with 22 additions and 86 deletions

View File

@@ -3,23 +3,11 @@ import { appUpdateAvailable, appUpdatesReducer, resetAppUpdate } from '../../../
describe('appUpdatesReducer', () => {
describe('reducer', () => {
it('returns true on APP_UPDATE_AVAILABLE', () => {
expect(appUpdatesReducer(undefined, { type: appUpdateAvailable.toString() })).toEqual(true);
expect(appUpdatesReducer(undefined, appUpdateAvailable())).toEqual(true);
});
it('returns false on RESET_APP_UPDATE', () => {
expect(appUpdatesReducer(undefined, { type: resetAppUpdate.toString() })).toEqual(false);
});
});
describe('appUpdateAvailable', () => {
it('creates expected action', () => {
expect(appUpdateAvailable()).toEqual({ type: appUpdateAvailable.toString() });
});
});
describe('resetAppUpdate', () => {
it('creates expected action', () => {
expect(resetAppUpdate()).toEqual({ type: resetAppUpdate.toString() });
expect(appUpdatesReducer(undefined, resetAppUpdate())).toEqual(false);
});
});
});