const { getReturnLink, isInteractionServiceForm } = require('../helpers')
const {
  INTERACTION_CONTEXTS,
} = require('../../../../src/apps/interactions/constants')

describe('Interaction helpers', () => {
  describe('#getReturnLink', () => {
    context('when the return link exists', () => {
      beforeEach(() => {
        this.actual = getReturnLink({ returnLink: '/return' })
      })

      it('should return the link', () => {
        expect(this.actual).to.equal('/return')
      })
    })

    context('when the return link does not exist', () => {
      beforeEach(() => {
        this.actual = getReturnLink(null)
      })

      it('should return the link', () => {
        expect(this.actual).to.equal('/interactions')
      })
    })
  })

  describe('#isInteractionServiceForm', () => {
    context('matching interaction form context values', () => {
      it('should return true', () => {
        expect(isInteractionServiceForm(INTERACTION_CONTEXTS[0])).to.equal(true)
        expect(isInteractionServiceForm(INTERACTION_CONTEXTS[1])).to.equal(true)
        expect(isInteractionServiceForm(INTERACTION_CONTEXTS[2])).to.equal(true)
        expect(isInteractionServiceForm(INTERACTION_CONTEXTS[3])).to.equal(true)
        expect(isInteractionServiceForm(INTERACTION_CONTEXTS[0])).to.equal(true)
      })
    })

    context('non matching interaction form values', () => {
      it('should return false', () => {
        expect(isInteractionServiceForm('some_context')).to.equal(false)
        expect(isInteractionServiceForm(undefined)).to.equal(false)
        expect(isInteractionServiceForm('')).to.equal(false)
        expect(isInteractionServiceForm(null)).to.equal(false)
      })
    })
  })
})

@@ -289,35 +289,53 @@
  =%3E %7B%0A      
-beforeEach(
+it('should return the link', 
 () =%3E %7B%0A    
@@ -330,37 +330,38 @@
 () =%3E %7B%0A        
-this.
+const 
 actual = getRetu
@@ -398,61 +398,8 @@
  %7D)%0A
-      %7D)%0A%0A      it('should return the link', () =%3E %7B%0A
     
@@ -401,37 +401,32 @@
 %0A        expect(
-this.
 actual).to.equal
@@ -523,19 +523,37 @@
     
-beforeEach(
+it('should return the link', 
 () =
@@ -564,21 +564,22 @@
         
-this.
+const 
 actual =
@@ -603,61 +603,8 @@
 ll)%0A
-      %7D)%0A%0A      it('should return the link', () =%3E %7B%0A
     
@@ -618,13 +618,8 @@
 ect(
-this.
 actu

Refactor interactions helper tests