-
Notifications
You must be signed in to change notification settings - Fork 914
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #284 from hhubik/settings-reducer-test
test(settings): Added settingsReducer unit tests
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { | ||
initialState, | ||
settingsReducer, | ||
ActionSettingsChangeTheme, | ||
ActionSettingsChangeAnimationsPage, | ||
ActionSettingsChangeAnimationsPageDisabled, | ||
ActionSettingsChangeAnimationsElements, | ||
ActionSettingsChangeAutoNightMode | ||
} from './settings.reducer'; | ||
|
||
describe('SettingsReducer', () => { | ||
it('should return default state', () => { | ||
const action = {} as any; | ||
const state = settingsReducer(undefined, action); | ||
expect(state).toBe(initialState); | ||
}); | ||
|
||
it('should update theme', () => { | ||
const action = new ActionSettingsChangeTheme({ theme: 'dark' }); | ||
const state = settingsReducer(undefined, action); | ||
expect(state.theme).toEqual('dark'); | ||
}); | ||
|
||
it('should update pageAnimations', () => { | ||
const action = new ActionSettingsChangeAnimationsPage({ | ||
pageAnimations: false | ||
}); | ||
const state = settingsReducer(undefined, action); | ||
expect(state.pageAnimations).toEqual(false); | ||
}); | ||
|
||
it('should update pageAnimationsDisabled and pageAnimations', () => { | ||
const action = new ActionSettingsChangeAnimationsPageDisabled({ | ||
pageAnimationsDisabled: true | ||
}); | ||
const state = settingsReducer(undefined, action); | ||
expect(state.pageAnimationsDisabled).toEqual(true); | ||
expect(state.pageAnimations).toEqual(false); | ||
}); | ||
|
||
it('should update elementsAnimations', () => { | ||
const action = new ActionSettingsChangeAnimationsElements({ | ||
elementsAnimations: false | ||
}); | ||
const state = settingsReducer(undefined, action); | ||
expect(state.elementsAnimations).toEqual(false); | ||
}); | ||
|
||
it('should update autoNightMode', () => { | ||
const action = new ActionSettingsChangeAutoNightMode({ | ||
autoNightMode: true | ||
}); | ||
const state = settingsReducer(undefined, action); | ||
expect(state.autoNightMode).toEqual(true); | ||
}); | ||
}); |