text: 'use strict';
  
  const TestWrapper = require('test/util/TestWrapper');
  const TaskList = require('app/steps/ui/tasklist');
  const CodicilsNumber = require('app/steps/ui/will/codicilsnumber');
  const testCommonContent = require('test/component/common/testCommonContent.js');
  const caseTypes = require('app/utils/CaseTypes');
  
  describe('will-codicils', () => {
      let testWrapper;
      const expectedNextUrlForTaskList = TaskList.getUrl();
      const expectedNextUrlForCodicilsNumber = CodicilsNumber.getUrl();
  
      beforeEach(() => {
          testWrapper = new TestWrapper('WillCodicils');
      });
  
      afterEach(() => {
          testWrapper.destroy();
      });
  
      describe('Verify Content, Errors and Redirection', () => {
          testCommonContent.runTest('WillCodicils', null, null, [], false, {type: caseTypes.GOP});
  
          it('test correct content loaded on the page', (done) => {
              const sessionData = {
                  type: caseTypes.GOP,
                  ccdCase: {
                      state: 'Pending',
                      id: 1234567890123456
                  }
              };
  
              testWrapper.agent.post('/prepare-session/form')
                  .send(sessionData)
                  .end(() => {
                      testWrapper.testContent(done);
                  });
          });
  
          it('test errors message displayed for missing data', (done) => {
              testWrapper.testErrors(done, {}, 'required');
          });
  
          it(`test it redirects to TaskList page: ${expectedNextUrlForTaskList}`, (done) => {
              const data = {
                  codicils: 'optionNo'
              };
  
              testWrapper.testRedirect(done, data, expectedNextUrlForTaskList);
          });
  
          it(`test it redirects to Codicils Number page: ${expectedNextUrlForCodicilsNumber}`, (done) => {
              const data = {
                  codicils: 'optionYes'
              };
  
              testWrapper.testRedirect(done, data, expectedNextUrlForCodicilsNumber);
          });
      });
  });
  