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