department-of-veterans-affairs/vets-website

View on GitHub
src/applications/check-in/utils/navigation/day-of/navigation.test.unit.spec.js

Summary

Maintainability
C
1 day
Test Coverage
import { expect } from 'chai';

import { createForm, getTokenFromLocation, CHECK_IN_FORM_PAGES } from './index';

describe('check in', () => {
  describe('navigation utils', () => {
    describe('getTokenFromLocation', () => {
      it('returns the id of the query object of the location provided', () => {
        const location = {
          query: {
            id: 'magic',
          },
        };
        const result = getTokenFromLocation(location);
        expect(result).to.equal('magic');
      });
      it('returns undefined if location is undefined', () => {
        const location = undefined;
        const result = getTokenFromLocation(location);
        expect(result).to.be.undefined;
      });
      it('returns undefined if location.query is undefined', () => {
        const location = {
          query: undefined,
        };
        const result = getTokenFromLocation(location);
        expect(result).to.be.undefined;
      });
    });
    describe('createForm', () => {
      it('should return all the pages when initialized', () => {
        const form = createForm();
        expect(form.length).to.equal(CHECK_IN_FORM_PAGES.length);
      });
    });
  });
});