describe('valueOf', () => {

    it('should return undefined when undefined given', () => {

      const actual: FormaliseRepaymentPlanOption = FormaliseRepaymentPlanOption.valueOf(undefined)

      expect(actual).to.be.eq(undefined)
    })

    it('should return undefined when unknown type given', () => {

      const actual: FormaliseRepaymentPlanOption = FormaliseRepaymentPlanOption.valueOf('I do not know this option!')

      expect(actual).to.be.eq(undefined)
    })

    FormaliseRepaymentPlanOption.all().forEach(option => {
      it(`should return valid object for ${option.value}`, () => {

        const actual: FormaliseRepaymentPlanOption = FormaliseRepaymentPlanOption.valueOf(option.value)

        expect(actual).to.be.equal(option)
      })
    })
  })
    it('should accept formaliseRepaymentPlan with recognised type', () => {
      FormaliseRepaymentPlanOption.all().forEach(option => {
        const errors = validator.validateSync(option)

        expect(errors.length).to.equal(0)
      })
    })
describe('Formalise repayment plan option filter', () => {
  FormaliseRepaymentPlanOption.all()
    .forEach(type => {
      it(`should map '${type.value}' to '${type.displayValue}'`, () => {
        expect(FormaliseRepaymentPlanOptionFilter.render(type)).to.equal(type.displayValue)
      })
    })

  it('should throw an error for null', () => {
    expect(() => FormaliseRepaymentPlanOptionFilter.render(null)).to.throw(Error)
  })
})
 deserialize (input?: any): FormaliseRepaymentPlan {
   if (input && input.option) {
     this.option = FormaliseRepaymentPlanOption.valueOf(input.option.value)
   }
   return this
 }
 static fromObject (input?: any): FormaliseRepaymentPlan {
   if (!input) {
     return input
   }
   return new FormaliseRepaymentPlan(FormaliseRepaymentPlanOption.valueOf(input.option))
 }
 it('should be completed when option is selected', () => {
   FormaliseRepaymentPlanOption.all().forEach(option => {
     expect(ChooseHowToProceedTask.isCompleted(new FormaliseRepaymentPlan(option))).to.be.true
   })
 })
    it('should return an array', () => {
      const actual: FormaliseRepaymentPlanOption[] = FormaliseRepaymentPlanOption.all()

      expect(actual).instanceof(Array)
      expect(actual.length).to.eq(3)
    })
      it(`should return valid object for ${option.value}`, () => {

        const actual: FormaliseRepaymentPlanOption = FormaliseRepaymentPlanOption.valueOf(option.value)

        expect(actual).to.be.equal(option)
      })
    it('should return undefined when unknown type given', () => {

      const actual: FormaliseRepaymentPlanOption = FormaliseRepaymentPlanOption.valueOf('I do not know this option!')

      expect(actual).to.be.eq(undefined)
    })
    it('should return undefined when undefined given', () => {

      const actual: FormaliseRepaymentPlanOption = FormaliseRepaymentPlanOption.valueOf(undefined)

      expect(actual).to.be.eq(undefined)
    })