diff --git a/i18n.js b/i18n.js index 5d8a50c..0867dfa 100644 --- a/i18n.js +++ b/i18n.js @@ -12,7 +12,7 @@ i18n .use(initReactI18next) .init({ fallbackLng: 'en', - debug: true, + debug: false, interpolation: { escapeValue: false, }, diff --git a/index.html b/index.html index a9d95e4..dace95a 100644 --- a/index.html +++ b/index.html @@ -4,10 +4,12 @@ Rumpi + - + + diff --git a/src/pages/LoginPage.jsx b/src/pages/LoginPage.jsx index 6bc4d7d..c1a93e1 100644 --- a/src/pages/LoginPage.jsx +++ b/src/pages/LoginPage.jsx @@ -16,7 +16,7 @@ const LoginPage = () => { return (
-
+

Rumpi.

@@ -30,7 +30,7 @@ const LoginPage = () => {

{t('no_account_yet')} {' '} - {t('register')} + {t('register')}

diff --git a/src/pages/RegisterPage.jsx b/src/pages/RegisterPage.jsx index 472c47d..e685568 100644 --- a/src/pages/RegisterPage.jsx +++ b/src/pages/RegisterPage.jsx @@ -19,7 +19,7 @@ const RegisterPage = () => { return (
-
+

Rumpi.

@@ -29,7 +29,7 @@ const RegisterPage = () => {

{t('already_have_account')} {' '} - {t('login')} + {t('login')}

diff --git a/src/states/theme/action.test.js b/src/states/theme/action.test.js new file mode 100644 index 0000000..c505f86 --- /dev/null +++ b/src/states/theme/action.test.js @@ -0,0 +1,41 @@ +/** + * - Test scenario themeAction + * - should create an action to toggle theme + * - should create an action to set light theme + * - should create an action to set dark theme + */ + +import { describe, it, expect } from 'vitest'; +import { ActionType, toggleTheme, setLightTheme, setDarkTheme } from './action'; + +describe('theme actions', () => { + it('should create an action to toggle theme', () => { + // Arrange + const expectedAction = { + type: ActionType.TOGGLE_THEME, + }; + + // Assert + expect(toggleTheme()).toEqual(expectedAction); + }); + + it('should create an action to set light theme', () => { + // Arrange + const expectedAction = { + type: ActionType.SET_LIGHT_THEME, + }; + + // Assert + expect(setLightTheme()).toEqual(expectedAction); + }); + + it('should create an action to set dark theme', () => { + // Arrange + const expectedAction = { + type: ActionType.SET_DARK_THEME, + }; + + // Assert + expect(setDarkTheme()).toEqual(expectedAction); + }); +}); \ No newline at end of file diff --git a/src/states/theme/reducer.test.js b/src/states/theme/reducer.test.js new file mode 100644 index 0000000..806e5ec --- /dev/null +++ b/src/states/theme/reducer.test.js @@ -0,0 +1,45 @@ +/** + * - Test scenario themeReducer + * - should return the initial state + * - should handle TOGGLE_THEME + * - should handle SET_LIGHT_THEME + * - should handle SET_DARK_THEME + */ + +import { describe, it, expect } from 'vitest'; +import themeReducer from './reducer'; + +import { ActionType } from './action'; + +describe('themeReducer', () => { + it('should return the initial state', () => { + const initialState = { mode: 'light' }; + const action = {}; + const state = themeReducer(initialState, action); + expect(state).toEqual(initialState); + }); + + it('should handle TOGGLE_THEME', () => { + const initialState = { mode: 'light' }; + const action = { type: ActionType.TOGGLE_THEME }; + const state = themeReducer(initialState, action); + expect(state).toEqual({ mode: 'dark' }); + + const newState = themeReducer(state, action); + expect(newState).toEqual({ mode: 'light' }); + }); + + it('should handle SET_LIGHT_THEME', () => { + const initialState = { mode: 'dark' }; + const action = { type: ActionType.SET_LIGHT_THEME }; + const state = themeReducer(initialState, action); + expect(state).toEqual({ mode: 'light' }); + }); + + it('should handle SET_DARK_THEME', () => { + const initialState = { mode: 'light' }; + const action = { type: ActionType.SET_DARK_THEME }; + const state = themeReducer(initialState, action); + expect(state).toEqual({ mode: 'dark' }); + }); +}); \ No newline at end of file