当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript eligibility-check.checkEligibilityGuards函数代码示例

本文整理汇总了TypeScript中test/features/claim/routes/checks/eligibility-check.checkEligibilityGuards函数的典型用法代码示例。如果您正苦于以下问题:TypeScript checkEligibilityGuards函数的具体用法?TypeScript checkEligibilityGuards怎么用?TypeScript checkEligibilityGuards使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了checkEligibilityGuards函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: describe

  describe('on POST', () => {
    checkAuthorizationGuards(app, 'post', ClaimPaths.resolvingThisDisputerPage.uri)
    checkEligibilityGuards(app, 'post', ClaimPaths.resolvingThisDisputerPage.uri)

    describe('for authorized user', () => {
      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
      })

      it('should return 500 and render error page when cannot save draft', async () => {
        draftStoreServiceMock.resolveFind('claim')
        draftStoreServiceMock.rejectSave()

        await request(app)
          .post(ClaimPaths.resolvingThisDisputerPage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .expect(res => expect(res).to.be.serverError.withText('Error'))
      })

      it('should redirect to task list when everything is fine', async () => {
        draftStoreServiceMock.resolveFind('claim')
        draftStoreServiceMock.resolveSave()

        await request(app)
          .post(ClaimPaths.resolvingThisDisputerPage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .expect(res => expect(res).to.be.redirect.toLocation(ClaimPaths.taskListPage.uri))
      })
    })
  })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:30,代码来源:resolving-this-dispute.ts

示例2: describe

  describe('on POST', () => {
    checkAuthorizationGuards(app, 'post', pagePath)
    checkEligibilityGuards(app, 'post', pagePath)

    describe('for authorized user', () => {

      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
      })

      it('should render page when form is invalid and everything is fine', async () => {
        draftStoreServiceMock.resolveFind('claim')

        await request(app)
          .post(pagePath)
          .set('Cookie', `${cookieName}=ABC`)
          .expect(res => expect(res).to.be.successful.withText(pageContent, 'div class="error-summary"'))
      })

      it('should return 500 and render error page when form is valid and cannot save draft', async () => {
        draftStoreServiceMock.resolveFind('claim')
        draftStoreServiceMock.rejectSave()

        await request(app)
          .post(pagePath)
          .set('Cookie', `${cookieName}=ABC`)
          .send({ type: InterestDateType.SUBMISSION })
          .expect(res => expect(res).to.be.serverError.withText('Error'))
      })

      it('should redirect to total page when form is valid, submission date selected and everything is fine', async () => {
        draftStoreServiceMock.resolveFind('claim')
        draftStoreServiceMock.resolveSave()

        await request(app)
          .post(pagePath)
          .set('Cookie', `${cookieName}=ABC`)
          .send({ type: InterestDateType.SUBMISSION })
          .expect(res => expect(res).to.be.redirect.toLocation(ClaimPaths.totalPage.uri))
      })

      it('should redirect to interest start date page when form is valid, custom date selected and everything is fine', async () => {
        draftStoreServiceMock.resolveFind('claim')
        draftStoreServiceMock.resolveSave()

        await request(app)
          .post(pagePath)
          .set('Cookie', `${cookieName}=ABC`)
          .send({
            type: InterestDateType.CUSTOM
          })
          .expect(res => expect(res).to.be.redirect.toLocation(ClaimPaths.interestStartDatePage.uri))
      })
    })
  })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:55,代码来源:interest-date.ts

示例3: describe

  describe('on POST', () => {
    checkAuthorizationGuards(app, 'post', ClaimPaths.defendantEmailPage.uri)
    checkEligibilityGuards(app, 'post', ClaimPaths.defendantEmailPage.uri)

    describe('for authorized user', () => {
      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
      })

      it('should render page when form is invalid and everything is fine', async () => {
        draftStoreServiceMock.resolveFind('claim')

        await request(app)
          .post(ClaimPaths.defendantEmailPage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .send({ address: 'invalid-email-address' })
          .expect(res => expect(res).to.be.successful.withText('Their email address (optional)', 'div class="error-summary"'))
      })

      it('should return 500 and render error page when form is valid and cannot save draft', async () => {
        draftStoreServiceMock.resolveFind('claim')
        draftStoreServiceMock.rejectSave()

        await request(app)
          .post(ClaimPaths.defendantEmailPage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .send({ address: 'defendant@example.com' })
          .expect(res => expect(res).to.be.serverError.withText('Error'))
      })

      it('should redirect to task list when form is valid and everything is fine', async () => {
        draftStoreServiceMock.resolveFind('claim')
        draftStoreServiceMock.resolveSave()

        await request(app)
          .post(ClaimPaths.defendantEmailPage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .send({ address: 'defendant@example.com' })
          .expect(res => expect(res).to.be.redirect.toLocation(ClaimPaths.taskListPage.uri))
      })

      it('should redirect to task list when no email address is given', async () => {
        draftStoreServiceMock.resolveFind('claim')
        draftStoreServiceMock.resolveSave()

        await request(app)
          .post(ClaimPaths.defendantEmailPage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .send({ address: '' })
          .expect(res => expect(res).to.be.redirect.toLocation(ClaimPaths.taskListPage.uri))
      })
    })
  })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:53,代码来源:defendant-email.ts

示例4: describe

  describe('on POST', () => {
    checkAuthorizationGuards(app, 'post', ClaimPaths.checkAndSendPage.uri)
    checkEligibilityGuards(app, 'post', ClaimPaths.checkAndSendPage.uri)

    describe('for authorized user', () => {
      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
      })

      it('should redirect to incomplete submission when not all tasks are completed', async () => {
        draftStoreServiceMock.resolveFind('claim', { readResolveDispute: false })

        await request(app)
          .post(ClaimPaths.checkAndSendPage.uri)
          .send({ type: SignatureType.BASIC })
          .set('Cookie', `${cookieName}=ABC`)
          .expect(res => expect(res).to.be.redirect.toLocation(ClaimPaths.incompleteSubmissionPage.uri))
      })

      it('should return 500 and render error page when form is invalid and cannot calculate fee', async () => {
        draftStoreServiceMock.resolveFind('claim')
        feesServiceMock.rejectCalculateIssueFee('HTTP error')

        await request(app)
          .post(ClaimPaths.checkAndSendPage.uri)
          .send({ type: SignatureType.BASIC })
          .set('Cookie', `${cookieName}=ABC`)
          .expect(res => expect(res).to.be.serverError.withText('Error'))
      })

      it('should render page when form is invalid and everything is fine', async () => {
        draftStoreServiceMock.resolveFind('claim')
        feesServiceMock.resolveCalculateIssueFee()

        await request(app)
          .post(ClaimPaths.checkAndSendPage.uri)
          .send({ type: SignatureType.BASIC })
          .set('Cookie', `${cookieName}=ABC`)
          .expect(res => expect(res).to.be.successful.withText('Check your answers', 'div class="error-summary"'))
      })

      it('should redirect to payment page when form is valid and everything is fine', async () => {
        draftStoreServiceMock.resolveFind('claim')

        await request(app)
          .post(ClaimPaths.checkAndSendPage.uri)
          .send({ type: SignatureType.BASIC })
          .set('Cookie', `${cookieName}=ABC`)
          .send({ signed: 'true' })
          .expect(res => expect(res).to.be.redirect.toLocation(ClaimPaths.startPaymentReceiver.uri))
      })
    })
  })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:53,代码来源:check-and-send.ts

示例5: describe

  describe('on POST', () => {
    checkAuthorizationGuards(app, 'post', ClaimPaths.claimantMobilePage.uri)
    checkEligibilityGuards(app, 'post', ClaimPaths.claimantMobilePage.uri)

    describe('for authorized user', () => {
      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
      })

      it('should render page when form is invalid and everything is fine', async () => {
        draftStoreServiceMock.resolveFind('claim')

        await request(app)
          .post(ClaimPaths.claimantMobilePage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .expect(res => expect(res).to.be.successful.withText(headerText, 'div class="error-summary"'))
      })

      it('should return 500 and render error page when form is valid and cannot save draft', async () => {
        draftStoreServiceMock.resolveFind('claim')
        draftStoreServiceMock.rejectSave()

        await request(app)
          .post(ClaimPaths.claimantMobilePage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .send({ number: '07000000000' })
          .expect(res => expect(res).to.be.serverError.withText('Error'))
      })

      it('should redirect to task list when form is valid and nothing is submitted', async () => {
        draftStoreServiceMock.resolveFind('claim')
        draftStoreServiceMock.resolveSave()

        await request(app)
          .post(ClaimPaths.claimantMobilePage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .send({ number: '' })
          .expect(res => expect(res).to.be.redirect.toLocation(ClaimPaths.taskListPage.uri))
      })

      it('should redirect to task list when form is valid and number is provided', async () => {
        draftStoreServiceMock.resolveFind('claim')
        draftStoreServiceMock.resolveSave()

        await request(app)
          .post(ClaimPaths.claimantMobilePage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .send({ number: '07000000000' })
          .expect(res => expect(res).to.be.redirect.toLocation(ClaimPaths.taskListPage.uri))
      })
    })
  })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:52,代码来源:claimant-mobile.ts

示例6: describe

  describe('on POST', () => {
    checkAuthorizationGuards(app, 'post', ClaimPaths.claimantDateOfBirthPage.uri)
    checkEligibilityGuards(app, 'post', ClaimPaths.claimantDateOfBirthPage.uri)

    describe('for authorized user', () => {
      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
      })

      it('should render page when form is empty and everything is fine', async () => {
        draftStoreServiceMock.resolveFind('claim')

        await request(app)
          .post(ClaimPaths.claimantDateOfBirthPage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .expect(res => expect(res).to.be.successful.withText('What is your date of birth?', 'div class="error-summary"'))
      })

      it('should render page with error when DOB is less than 18', async () => {
        draftStoreServiceMock.resolveFind('claim')
        const date: Moment = MomentFactory.currentDate().subtract(1, 'year')
        await request(app)
          .post(ClaimPaths.claimantDateOfBirthPage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .send({ known: 'true', date: { day: date.date(), month: date.month() + 1, year: date.year() } })
          .expect(res => expect(res).to.be.successful.withText('Please enter a date of birth before', 'div class="error-summary"'))
      })

      it('should return 500 and render error page when form is valid and cannot save draft', async () => {
        draftStoreServiceMock.resolveFind('claim')
        draftStoreServiceMock.rejectSave()

        await request(app)
          .post(ClaimPaths.claimantDateOfBirthPage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .send({ known: 'true', date: { day: '31', month: '12', year: '1980' } })
          .expect(res => expect(res).to.be.serverError.withText('Error'))
      })

      it('should redirect to claimant mobile page when form is valid and everything is fine', async () => {
        draftStoreServiceMock.resolveFind('claim')
        draftStoreServiceMock.resolveSave()

        await request(app)
          .post(ClaimPaths.claimantDateOfBirthPage.uri)
          .set('Cookie', `${cookieName}=ABC`)
          .send({ known: 'true', date: { day: '31', month: '12', year: '1980' } })
          .expect(res => expect(res).to.be.redirect.toLocation(ClaimPaths.claimantMobilePage.uri))
      })
    })
  })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:51,代码来源:claimant-dob.ts

示例7: describe

  describe('on GET', () => {
    checkAuthorizationGuards(app, 'get', ClaimPaths.defendantSoleTraderOrSelfEmployedDetailsPage.uri)
    checkEligibilityGuards(app, 'get', ClaimPaths.defendantSoleTraderOrSelfEmployedDetailsPage.uri)

    it('should render page when everything is fine', async () => {
      idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
      draftStoreServiceMock.resolveFind('claim')

      await request(app)
        .get(ClaimPaths.defendantSoleTraderOrSelfEmployedDetailsPage.uri)
        .set('Cookie', `${cookieName}=ABC`)
        .expect(res => expect(res).to.be.successful.withText(theirTitle, theirFirstName, theirLastName))
    })
  })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:14,代码来源:defendant-sole-trader-details.ts

示例8: describe

  describe('on GET', () => {
    checkAuthorizationGuards(app, 'get', pagePath)
    checkEligibilityGuards(app, 'get', pagePath)

    it('should render page when everything is fine', async () => {
      idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
      draftStoreServiceMock.resolveFind('claim')

      await request(app)
        .get(pagePath)
        .set('Cookie', `${cookieName}=ABC`)
        .expect(res => expect(res).to.be.successful.withText(pageContent))
    })
  })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:14,代码来源:interest.ts

示例9: describe

  describe('on GET', () => {
    checkAuthorizationGuards(app, 'get', ClaimPaths.defendantPartyTypeSelectionPage.uri)
    checkEligibilityGuards(app, 'get', ClaimPaths.defendantPartyTypeSelectionPage.uri)

    it('should render page when everything is fine', async () => {
      idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
      draftStoreServiceMock.resolveFind('claim')

      await request(app)
        .get(ClaimPaths.defendantPartyTypeSelectionPage.uri)
        .set('Cookie', `${cookieName}=ABC`)
        .expect(res => expect(res).to.be.successful.withText(expectedTextOnPage))
    })
  })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:14,代码来源:defendant-party-type-selection.ts

示例10: describe

  describe('on GET', () => {
    checkAuthorizationGuards(app, 'get', ClaimPaths.incompleteSubmissionPage.uri)
    checkEligibilityGuards(app, 'get', ClaimPaths.incompleteSubmissionPage.uri)

    it('should render page when everything is fine', async () => {
      idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
      draftStoreServiceMock.resolveFind('claim')

      await request(app)
        .get(ClaimPaths.incompleteSubmissionPage.uri)
        .set('Cookie', `${cookieName}=ABC`)
        .expect(res => expect(res).to.be.successful
          .withText('You need to complete all sections before you submit your claim'))
    })
  })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:15,代码来源:incomplete-submission.ts


注:本文中的test/features/claim/routes/checks/eligibility-check.checkEligibilityGuards函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。