Add tests for settings reducer
Summary: yiss_tests Reviewed By: jknoxville Differential Revision: D18851134 fbshipit-source-id: 53ffb9b516773df19c258e7d819962e3cd523751
This commit is contained in:
committed by
Facebook Github Bot
parent
425d4b9024
commit
0c7b03cad3
36
src/reducers/__tests__/settings.node.tsx
Normal file
36
src/reducers/__tests__/settings.node.tsx
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*
|
||||||
|
* @format
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {default as reducer, updateSettings, Tristate} from '../settings';
|
||||||
|
|
||||||
|
test('init', () => {
|
||||||
|
const res = reducer(undefined, {type: 'INIT'});
|
||||||
|
expect(res.enableAndroid).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('updateSettings', () => {
|
||||||
|
const initialSettings = reducer(undefined, {type: 'INIT'});
|
||||||
|
const updatedSettings = Object.assign(initialSettings, {
|
||||||
|
enableAndroid: false,
|
||||||
|
enablePrefetching: Tristate.True,
|
||||||
|
jsApps: {
|
||||||
|
webAppLauncher: {
|
||||||
|
height: 900,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const res = reducer(initialSettings, updateSettings(updatedSettings));
|
||||||
|
|
||||||
|
expect(res.enableAndroid).toBeFalsy();
|
||||||
|
expect(res.enablePrefetching).toEqual(Tristate.True);
|
||||||
|
expect(res.jsApps.webAppLauncher.height).toEqual(900);
|
||||||
|
expect(res.jsApps.webAppLauncher.width).toEqual(
|
||||||
|
initialSettings.jsApps.webAppLauncher.width,
|
||||||
|
);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user