1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2024-12-12 16:57:03 +01:00
Whalebird-desktop-client-ma.../spec/renderer/unit/store/Preferences/Appearance.spec.ts
2019-06-05 21:51:02 +09:00

41 lines
1.3 KiB
TypeScript

import Theme from '~/src/constants/theme'
import DisplayStyle from '~/src/constants/displayStyle'
import TimeFormat from '~/src/constants/timeFormat'
import { LightTheme } from '~/src/constants/themeColor'
import DefaultFonts from '@/utils/fonts'
import Appearance, { AppearanceState, MUTATION_TYPES } from '@/store/Preferences/Appearance'
describe('Preferences/Appearance', () => {
let state: AppearanceState
beforeEach(() => {
state = {
appearance: {
theme: Theme.Light.key,
fontSize: 14,
displayNameStyle: DisplayStyle.DisplayNameAndUsername.value,
timeFormat: TimeFormat.Absolute.value,
customThemeColor: LightTheme,
font: DefaultFonts[0],
tootPadding: 8
},
fonts: []
}
})
describe('mutations', () => {
describe('updateAppearance', () => {
it('should be changed', () => {
Appearance.mutations![MUTATION_TYPES.UPDATE_APPEARANCE](state, {
theme: Theme.Dark.key
})
expect(state.appearance.theme).toEqual(Theme.Dark.key)
})
})
describe('updateFonts', () => {
it('should be changed', () => {
Appearance.mutations![MUTATION_TYPES.UPDATE_FONTS](state, ['font'])
expect(state.fonts).toEqual(['font'])
})
})
})
})