client/src/reducers/__tests__/miscReducer.test.js
changeset 168 ea92f4fe783d
equal deleted inserted replaced
167:1f340f3597a8 168:ea92f4fe783d
       
     1 
       
     2 import { autoSubmit, online } from '../miscReducer';
       
     3 import * as types from '../../constants/actionTypes';
       
     4 
       
     5 
       
     6 describe('misc reducer autosubmit', () => {
       
     7 
       
     8   it('should return the initial state', () => {
       
     9     expect(
       
    10       autoSubmit(undefined, {})
       
    11     ).toEqual(false)
       
    12   });
       
    13 
       
    14   it('should handle USER_TOGGLE_AUTO_SUBMIT true', () => {
       
    15     expect(
       
    16       autoSubmit(false, {
       
    17         type: types.USER_TOGGLE_AUTO_SUBMIT,
       
    18         value: true
       
    19       })
       
    20     ).toEqual(true)
       
    21   });
       
    22 
       
    23   it('should handle USER_TOGGLE_AUTO_SUBMIT false', () => {
       
    24     expect(
       
    25       autoSubmit(true, {
       
    26         type: types.USER_TOGGLE_AUTO_SUBMIT,
       
    27         value: false
       
    28       })
       
    29     ).toEqual(false)
       
    30   });
       
    31 
       
    32 });
       
    33 
       
    34 
       
    35 
       
    36 describe('misc reducer online', () => {
       
    37 
       
    38   it('should return the initial state', () => {
       
    39     expect(
       
    40       online(undefined, {})
       
    41     ).toEqual(false)
       
    42   });
       
    43 
       
    44   it('should handle STATUS_ONLINE', () => {
       
    45     expect(
       
    46       online(false, {
       
    47         type: types.STATUS_ONLINE
       
    48       })
       
    49     ).toEqual(true)
       
    50   });
       
    51 
       
    52   it('should handle STATUS_OFFLINE', () => {
       
    53     expect(
       
    54       online(true, {
       
    55         type: types.STATUS_OFFLINE
       
    56       })
       
    57     ).toEqual(false)
       
    58   });
       
    59 
       
    60 });