All files / window reducer.ts

100% Statements 9/9
100% Branches 5/5
100% Functions 1/1
100% Lines 8/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25  1x               4x 4x     1x   2x   1x     1x        
import {QUIT, WINDOW_TOGGLE} from './types';
 
/**
 * Window open status reducer
 * @param  {} open=false
 * @param  {Action} action
 * @returns boolean window open status
 */
export default function windowReducer(
  open = false, action: Action
): boolean {
  switch (action.type) {
 
    case QUIT:
      // TODO: trigger quit
      return false;
 
    case WINDOW_TOGGLE:
      return !open;
 
    default:
      return open;
  }
}