Skip to content

Commit da26b2b

Browse files
committed
Fix issue where theme is undefined in Preferences unit test.
1 parent c89a613 commit da26b2b

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

client/modules/IDE/components/Preferences/Preferences.unit.test.jsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import { act, fireEvent, reduxRender, screen } from '../../../../test-utils';
3+
import { initialState } from '../../reducers/preferences';
34
import Preferences from './index';
45
import * as PreferencesActions from '../../actions/preferences';
56

@@ -15,7 +16,10 @@ describe('<Preferences />', () => {
1516
const subject = (initialPreferences = {}) =>
1617
reduxRender(<Preferences />, {
1718
initialState: {
18-
preferences: initialPreferences
19+
preferences: {
20+
...initialState,
21+
...initialPreferences
22+
}
1923
}
2024
});
2125

client/modules/IDE/reducers/preferences.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as ActionTypes from '../../../constants';
22

3-
const initialState = {
3+
export const initialState = {
44
fontSize: 18,
55
autosave: true,
66
linewrap: true,

client/testData/testReduxStore.js

+2-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { initialState as initialFilesState } from '../modules/IDE/reducers/files';
2+
import { initialState as initialPrefState } from '../modules/IDE/reducers/preferences';
23

34
const mockProjects = [
45
{
@@ -46,20 +47,7 @@ const initialTestState = {
4647
parentId: undefined
4748
},
4849
files: initialFilesState(),
49-
preferences: {
50-
fontSize: 18,
51-
autosave: true,
52-
linewrap: true,
53-
lineNumbers: true,
54-
lintWarning: false,
55-
textOutput: false,
56-
gridOutput: false,
57-
theme: 'light',
58-
autorefresh: false,
59-
language: 'en-US',
60-
autocloseBracketsQuotes: true,
61-
autocompleteHinter: false
62-
},
50+
preferences: initialPrefState,
6351
user: {
6452
6553
username: 'happydog',

0 commit comments

Comments
 (0)