department-of-veterans-affairs/vets-website

View on GitHub
src/applications/check-in/reducers/reducer.unit.spec.js

Summary

Maintainability
A
0 mins
Test Coverage
import { expect } from 'chai';

import reducer from './index';

describe('check in', () => {
  describe('reducer', () => {
    describe('initial state and default actions', () => {
      it('should return the init state with no action', () => {
        const state = reducer.checkInData(undefined, {});
        expect(state).to.deep.equal({
          app: '',
          appointments: [],
          upcomingAppointments: [],
          veteranData: {
            demographics: {},
            address: '',
          },
          context: {},
          form: {
            pages: [],
            data: {},
          },
          error: '',
        });
      });
      it('should return the state if action is not found', () => {
        const mockState = {
          a: 1,
          b: 2,
          c: 3,
        };
        const state = reducer.checkInData(mockState, {});
        expect(state).to.deep.equal(mockState);
      });
    });
  });
});