• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript ccj-requested-check.checkCountyCourtJudgmentRequestedGuard函数代码示 ...

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: describe

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

      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor(claimStoreServiceMock.sampleClaimObj.defendantId, 'citizen', 'defendant')
      })

      checkAlreadySubmittedGuard(app, method, pagePath)
      checkCountyCourtJudgmentRequestedGuard(app, method, pagePath)

      describe('errors are handled properly', () => {

        it('should return 500 and render error page when cannot retrieve claim', async () => {
          claimStoreServiceMock.rejectRetrieveClaimByExternalId('HTTP error')

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

        it('should return 500 and render error page when cannot retrieve draft', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.rejectFind('Error')

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

      context('should redirect to Employment page when', () => {

        it('"no" selected', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')
          draftStoreServiceMock.resolveSave()

          await request(app)
            .post(pagePath)
            .send({ declared: 'false' })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.redirect
              .toLocation(StatementOfMeansPaths.carerPage.evaluateUri(
                { externalId: claimStoreServiceMock.sampleClaimObj.externalId })
              )
            )
        })

        it('"yes" selected', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')
          draftStoreServiceMock.resolveSave()

          await request(app)
            .post(pagePath)
            .send({
              declared: 'false',
              numberOfPeople: { value: 1, details: 'It is my story' }
            })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.redirect
              .toLocation(StatementOfMeansPaths.carerPage.evaluateUri(
                { externalId: claimStoreServiceMock.sampleClaimObj.externalId })
              )
            )
        })
      })
    })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:69,代码来源:other-dependants.ts


示例2: describe

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

      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor(claimStoreServiceMock.sampleClaimObj.defendantId, 'citizen', 'defendant')
      })

      checkAlreadySubmittedGuard(app, method, pagePath)
      checkCountyCourtJudgmentRequestedGuard(app, method, pagePath)

      describe('errors are handled properly', () => {

        it('should return 500 and render error page when cannot retrieve claim', async () => {
          claimStoreServiceMock.rejectRetrieveClaimByExternalId('HTTP error')

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

        it('should return 500 and render error page when cannot retrieve draft', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.rejectFind('Error')

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

      describe('save and continue', () => {

        it('should update draft store and redirect', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')
          draftStoreServiceMock.resolveSave()

          await request(app)
            .post(pagePath)
            .send({ rows: [{ typeOfAccount: BankAccountType.ISA.value, joint: false, balance: 10 }] })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.redirect
              .toLocation(StatementOfMeansPaths.disabilityPage.evaluateUri(
                { externalId: claimStoreServiceMock.sampleClaimObj.externalId })
              )
            )
        })
      })

      describe('add a new row', () => {

        it('should update draft store and redirect', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')

          await request(app)
            .post(pagePath)
            .send({ action: { addRow: 'Add row' } })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.successful.withText('List your bank and savings accounts'))
        })
      })
    })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:64,代码来源:bank-accounts.ts


示例3: describe

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

      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor(claimStoreServiceMock.sampleClaimObj.defendantId, 'citizen', 'defendant')
      })

      checkAlreadySubmittedGuard(app, method, pagePath)
      checkCountyCourtJudgmentRequestedGuard(app, method, pagePath)

      describe('errors are handled properly', () => {

        it('should return 500 and render error page when cannot retrieve claim', async () => {
          claimStoreServiceMock.rejectRetrieveClaimByExternalId('HTTP error')

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

        it('should return 500 and render error page when cannot retrieve draft', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.rejectFind('Error')

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

      describe('save and continue', () => {

        it('should update draft store and redirect', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission', draftOverride)
          draftStoreServiceMock.resolveSave()

          await request(app)
            .post(pagePath)
            .send({ rows: [{ employerName: 'Comp1', jobTitle: 'BA' }, { employerName: 'Comp2', jobTitle: 'UX' }] })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.redirect
              .toLocation(StatementOfMeansPaths.courtOrdersPage.evaluateUri(
                { externalId: claimStoreServiceMock.sampleClaimObj.externalId })
              )
            )
        })
      })

      describe('add a new row', () => {

        it('should update draft store and redirect', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission', draftOverride)

          await request(app)
            .post(pagePath)
            .send({ action: { addRow: 'Add row' } })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.successful.withText('Who employs you?'))
        })
      })
    })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:64,代码来源:employers.ts


示例4: describe

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

      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor(claimStoreServiceMock.sampleClaimObj.defendantId, 'citizen', 'defendant')
      })

      checkAlreadySubmittedGuard(app, method, pagePath)
      checkCountyCourtJudgmentRequestedGuard(app, method, pagePath)

      describe('errors are handled properly', () => {

        it('should return 500 and render error page when cannot retrieve claim', async () => {
          claimStoreServiceMock.rejectRetrieveClaimByExternalId('HTTP error')

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

        it('should return 500 and render error page when cannot retrieve draft', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.rejectFind('Error')

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

        it('should trigger validation when negative amount is given', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')

          await request(app)
            .post(pagePath)
            .send({
              salarySource: {
                amount: -100,
                schedule: IncomeExpenseSchedule.MONTH.value
              },
              pensionSource: {
                amount: -200,
                schedule: IncomeExpenseSchedule.TWO_WEEKS.value
              }})
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.successful.withText('Enter a valid income from your job amount, maximum two decimal places'))
            .expect(res => expect(res).to.be.successful.withText('Enter a valid pension amount, maximum two decimal places'))
        })

        it('should trigger validation when invalid decimal amount is given', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')

          await request(app)
            .post(pagePath)
            .send({
              salarySource: {
                amount: 100.123,
                schedule: IncomeExpenseSchedule.MONTH.value
              },
              jobseekerAllowanceIncomeSource: {
                amount: 200.345,
                schedule: IncomeExpenseSchedule.TWO_WEEKS.value
              } })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.successful.withText('Enter a valid income from your job amount, maximum two decimal places'))
            .expect(res => expect(res).to.be.successful.withText('Enter a valid Jobseeker’s Allowance (income based) amount, maximum two decimal places'))
        })

        it('should trigger validation when no amount is given', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')

          await request(app)
            .post(pagePath)
            .send({
              salarySource: {
                schedule: IncomeExpenseSchedule.MONTH.value
              },
              incomeSupportSource: {
                schedule: IncomeExpenseSchedule.MONTH.value
              } })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.successful.withText('Enter how much income from your job you receive'))
            .expect(res => expect(res).to.be.successful.withText('Enter how much Income Support you receive'))
        })

        it('should trigger validation when no schedule is given', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')

          await request(app)
            .post(pagePath)
            .send({
              salarySource: {
                amount: 100
              },
              childTaxCreditSource: {
                amount: 700
//.........这里部分代码省略.........
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:101,代码来源:monthly-income.ts


示例5: context

      context('when defendant authorised', () => {
        beforeEach(() => {
          idamServiceMock.resolveRetrieveUserFor(claimStoreServiceMock.sampleClaimObj.defendantId, 'citizen')
        })

        checkCountyCourtJudgmentRequestedGuard(app, method, pagePath)

        context('when response not submitted', () => {
          it('should return 500 and render error page when cannot retrieve claim', async () => {
            claimStoreServiceMock.rejectRetrieveClaimByExternalId('HTTP error')

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

        })
        context('when form is valid', () => {
          it('should redirect to defendant task list when defendant says yes', async () => {
            draftStoreServiceMock.resolveFind('mediation')
            draftStoreServiceMock.resolveFind('response:full-rejection', { defendantDetails: { partyDetails: { ...draftStoreServiceMock.sampleOrganisationDetails } } })
            draftStoreServiceMock.resolveSave()
            claimStoreServiceMock.resolveRetrieveClaimBySampleExternalId(claimStoreServiceMock.sampleClaimIssueOrgVOrgObj)

            await request(app)
              .post(pagePath)
              .set('Cookie', `${cookieName}=ABC`)
              .send({ option: FreeMediationOption.YES, mediationPhoneNumberConfirmation: '07777777777' })
              .expect(res => expect(res).to.be.redirect
                .toLocation(ResponsePaths.taskListPage
                  .evaluateUri({ externalId: claimStoreServiceMock.sampleClaimObj.externalId })))
          })

          it('should show validation error when defendant says yes with no phone number', async () => {
            draftStoreServiceMock.resolveFind('mediation')
            draftStoreServiceMock.resolveFind('response:full-rejection', { defendantDetails: { partyDetails: { ...draftStoreServiceMock.sampleOrganisationDetails } } })
            claimStoreServiceMock.resolveRetrieveClaimBySampleExternalId(claimStoreServiceMock.sampleClaimIssueOrgVOrgObj)

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

          it('should redirect to response task list when no was chosen and a phone number and a contact is given', async () => {
            draftStoreServiceMock.resolveFind('mediation')
            draftStoreServiceMock.resolveFind('response:full-rejection', { defendantDetails: { partyDetails: { ...draftStoreServiceMock.sampleOrganisationDetails } } })
            draftStoreServiceMock.resolveSave()
            claimStoreServiceMock.resolveRetrieveClaimBySampleExternalId(claimStoreServiceMock.sampleClaimIssueOrgVOrgObj)

            await request(app)
              .post(pagePath)
              .set('Cookie', `${cookieName}=ABC`)
              .send({
                option: FreeMediationOption.NO,
                mediationPhoneNumber: '07777777777',
                mediationContactPerson: 'Mary Richards'
              })
              .expect(res => expect(res).to.be.redirect
                .toLocation(ResponsePaths.taskListPage
                  .evaluateUri({ externalId: claimStoreServiceMock.sampleClaimObj.externalId })))
          })

          it('should show validation error when defendant says no with no phone number', async () => {
            draftStoreServiceMock.resolveFind('mediation')
            draftStoreServiceMock.resolveFind('response:full-rejection', { defendantDetails: { partyDetails: { ...draftStoreServiceMock.sampleOrganisationDetails } } })
            claimStoreServiceMock.resolveRetrieveClaimBySampleExternalId(claimStoreServiceMock.sampleClaimIssueOrgVOrgObj)

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

          it('should show validation error when defendant says no with no contact name', async () => {
            draftStoreServiceMock.resolveFind('mediation')
            draftStoreServiceMock.resolveFind('response:full-rejection', { defendantDetails: { partyDetails: { ...draftStoreServiceMock.sampleOrganisationDetails } } })
            claimStoreServiceMock.resolveRetrieveClaimBySampleExternalId(claimStoreServiceMock.sampleClaimIssueOrgVOrgObj)

            await request(app)
              .post(pagePath)
              .set('Cookie', `${cookieName}=ABC`)
              .send({
                option: FreeMediationOption.NO,
                mediationPhoneNumber: '07777777777',
                mediationContactPerson: undefined
              })
              .expect(res => expect(res).to.be.successful.withText('div class="error-summary"'))
          })
        })
      })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:94,代码来源:can-we-use-company.ts


示例6: context

      context('when defendant authorised', () => {
        beforeEach(() => {
          idamServiceMock.resolveRetrieveUserFor(claimStoreServiceMock.sampleClaimObj.defendantId, 'citizen')
        })

        checkCountyCourtJudgmentRequestedGuard(app, method, pagePath)

        context('when response not submitted', () => {
          context('when form is invalid', () => {
            it('should return 500 and render error page when cannot retrieve claim', async () => {
              claimStoreServiceMock.rejectRetrieveClaimByExternalId('HTTP error')

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

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

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

            it('should redirect to can we use page when everything is fine', async () => {
              claimStoreServiceMock.resolveRetrieveClaimByExternalId()
              draftStoreServiceMock.resolveFind('mediation')
              draftStoreServiceMock.resolveFind('response')
              draftStoreServiceMock.resolveSave()

              await request(app)
                .post(pagePath)
                .set('Cookie', `${cookieName}=ABC`)
                .send({ option: FreeMediationOption.YES })
                .expect(res => expect(res).to.be.redirect
                  .toLocation(MediationPaths.mediationAgreementPage
                    .evaluateUri({ externalId: claimStoreServiceMock.sampleClaimObj.externalId })))
            })

            it('should redirect to response task list when No was chosen and no response is available', async () => {
              claimStoreServiceMock.resolveRetrieveClaimByExternalId()
              draftStoreServiceMock.resolveFind('mediation')
              draftStoreServiceMock.resolveFind('response')
              draftStoreServiceMock.resolveSave()

              await request(app)
                .post(pagePath)
                .set('Cookie', `${cookieName}=ABC`)
                .send({ option: FreeMediationOption.NO })
                .expect(res => expect(res).to.be.redirect
                  .toLocation(ResponsePaths.taskListPage
                    .evaluateUri({ externalId: claimStoreServiceMock.sampleClaimObj.externalId })))
            })
          })
        })
      })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:65,代码来源:will-you-try-mediation.ts


示例7: describe

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

      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor(claimStoreServiceMock.sampleClaimObj.defendantId, 'citizen', 'defendant')
      })

      checkAlreadySubmittedGuard(app, method, pagePath)
      checkCountyCourtJudgmentRequestedGuard(app, method, pagePath)

      describe('errors are handled properly', () => {

        it('should return 500 and render error page when cannot retrieve claim', async () => {
          claimStoreServiceMock.rejectRetrieveClaimByExternalId('HTTP error')

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

        it('should return 500 and render error page when cannot retrieve draft', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.rejectFind('Error')

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

      describe('should update draft store and redirect', () => {

        it('to unemployed page', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')
          draftStoreServiceMock.resolveSave()

          await request(app)
            .post(pagePath)
            .send({ declared: false })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.redirect
              .toLocation(StatementOfMeansPaths.unemployedPage.evaluateUri(
                { externalId: claimStoreServiceMock.sampleClaimObj.externalId })
              )
            )
        })

        it('to employers page', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')
          draftStoreServiceMock.resolveSave()

          await request(app)
            .post(pagePath)
            .send({ declared: true, selfEmployed: true, employed: true })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.redirect
              .toLocation(StatementOfMeansPaths.employersPage.evaluateUri(
                { externalId: claimStoreServiceMock.sampleClaimObj.externalId })
              )
            )
        })

        it('to self-employment page', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')
          draftStoreServiceMock.resolveSave()

          await request(app)
            .post(pagePath)
            .send({ declared: true, selfEmployed: true, employed: false })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.redirect
              .toLocation(StatementOfMeansPaths.selfEmploymentPage.evaluateUri(
                { externalId: claimStoreServiceMock.sampleClaimObj.externalId })
              )
            )
        })
      })
    })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:82,代码来源:employment.ts


示例8: describe

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

      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor(claimStoreServiceMock.sampleClaimObj.defendantId, 'citizen', 'defendant')
      })

      checkAlreadySubmittedGuard(app, method, pagePath)
      checkCountyCourtJudgmentRequestedGuard(app, method, pagePath)

      describe('errors are handled properly', () => {

        it('should return 500 and render error page when cannot retrieve claim', async () => {
          claimStoreServiceMock.rejectRetrieveClaimByExternalId('HTTP error')

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

        it('should return 500 and render error page when cannot retrieve draft', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.rejectFind('Error')

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

      describe('should update draft store and redirect to ', () => {

        it('other dependants page when no children', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')
          draftStoreServiceMock.resolveSave()

          await request(app)
            .post(pagePath)
            .send({ declared: 'false' })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.redirect
              .toLocation(StatementOfMeansPaths.otherDependantsPage.evaluateUri(
                { externalId: claimStoreServiceMock.sampleClaimObj.externalId })
              )
            )
        })

        it('dependants disability page when some children but 0 between 16 and 19', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')
          draftStoreServiceMock.resolveSave()

          await request(app)
            .post(pagePath)
            .send({
              declared: 'true',
              numberOfChildren: { under11: '1', between11and15: '2', between16and19: '0' }
            })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.redirect
              .toLocation(StatementOfMeansPaths.dependantsDisabilityPage.evaluateUri(
                { externalId: claimStoreServiceMock.sampleClaimObj.externalId })
              )
            )
        })

        it('education page when > 0 children between 16 and 19', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')
          draftStoreServiceMock.resolveSave()

          await request(app)
            .post(pagePath)
            .send({
              declared: 'true',
              numberOfChildren: { under11: '0', between11and15: '0', between16and19: '3' }
            })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.redirect
              .toLocation(StatementOfMeansPaths.educationPage.evaluateUri(
                { externalId: claimStoreServiceMock.sampleClaimObj.externalId })
              )
            )
        })
      })
    })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:88,代码来源:dependants.ts


示例9: context

    context('when user authorised', () => {
      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor(claimStoreServiceMock.sampleClaimObj.defendantId, 'citizen')
      })

      checkAlreadySubmittedGuard(app, method, pagePath)
      checkCountyCourtJudgmentRequestedGuard(app, method, pagePath)

      context('when response not submitted', () => {
        context('when form is invalid', () => {
          it('should render page when everything is fine', async () => {
            claimStoreServiceMock.resolveRetrieveClaimByExternalId()
            draftStoreServiceMock.resolveFind('response')

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

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

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

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

            await request(app)
              .post(pagePath)
              .set('Cookie', `${cookieName}=ABC`)
              .send({ type: ResponseType.FULL_ADMISSION })
              .expect(res => expect(res).to.be.redirect
                .toLocation(ResponsePaths.taskListPage.evaluateUri({ externalId: externalId })))
          })

          it('should redirect to send your response by email page when everything is fine and PART_ADMISSION is selected', async () => {
            claimStoreServiceMock.resolveRetrieveClaimByExternalId()
            draftStoreServiceMock.resolveFind('response')
            draftStoreServiceMock.resolveSave()

            await request(app)
              .post(pagePath)
              .set('Cookie', `${cookieName}=ABC`)
              .send({ type: ResponseType.PART_ADMISSION })
              .expect(res => expect(res).to.be.redirect
                .toLocation(PartAdmissionPaths.alreadyPaidPage.evaluateUri({ externalId: externalId })))
          })

          it('should redirect to reject all of claim page when everything is fine and DEFENCE is selected', async () => {
            claimStoreServiceMock.resolveRetrieveClaimByExternalId()
            draftStoreServiceMock.resolveFind('response')
            draftStoreServiceMock.resolveSave()

            await request(app)
              .post(pagePath)
              .set('Cookie', `${cookieName}=ABC`)
              .send({ type: ResponseType.DEFENCE })
              .expect(res => expect(res).to.be.redirect
                .toLocation(ResponsePaths.defenceRejectAllOfClaimPage.evaluateUri({ externalId: externalId })))
          })
        })
      })
    })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:75,代码来源:response-type.ts


示例10: context

    context('when user authorised', () => {
      beforeEach(() => {
        idamServiceMock.resolveRetrieveUserFor(claimStoreServiceMock.sampleClaimObj.defendantId, 'citizen')
      })

      checkAlreadySubmittedGuard(app, method, pagePath)
      checkCountyCourtJudgmentRequestedGuard(app, method, pagePath)

      context('when response not submitted', () => {
        it('should redirect to incomplete submission when not all tasks are completed', async () => {
          draftStoreServiceMock.resolveFind(draftType, { defendantDetails: undefined })
          draftStoreServiceMock.resolveFind('mediation')
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()

          await request(app)
            .get(pagePath)
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.redirect
              .toLocation(ResponsePaths.incompleteSubmissionPage.evaluateUri({ externalId: claimStoreServiceMock.sampleClaimObj.externalId })))
        })

        it('should return 500 and render error page when cannot retrieve claim', async () => {
          claimStoreServiceMock.rejectRetrieveClaimByExternalId('HTTP error')

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

        it('should render page when everything is fine', async () => {
          draftStoreServiceMock.resolveFind(draftType)
          draftStoreServiceMock.resolveFind('mediation')
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()

          await request(app)
            .get(pagePath)
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.successful.withText('Check your answers'))
        })

        context('for individual and sole traders', () => {
          it('should return statement of truth with a tick box', async () => {
            draftStoreServiceMock.resolveFind(draftType)
            draftStoreServiceMock.resolveFind('mediation')
            claimStoreServiceMock.resolveRetrieveClaimByExternalId()

            await request(app)
              .get(pagePath)
              .set('Cookie', `${cookieName}=ABC`)
              .expect(res => expect(res).to.be.successful.withText('Statement of truth'))
              .expect(res => expect(res).to.be.successful.withText('I believe that the facts stated in this response are true.'))
              .expect(res => expect(res).to.be.successful.withText('<input id="signedtrue" type="checkbox" name="signed" value="true"'))
          })
        })
        context('for company and organisation', () => {
          it('should return statement of truth with a tick box', async () => {

            draftStoreServiceMock.resolveFind('response:company')
            draftStoreServiceMock.resolveFind('mediation')
            const claimStoreOverride = {
              claim: {
                claimants: [
                  {
                    type: 'company',
                    name: 'John Smith Ltd',
                    contactPerson: 'John Smith',
                    address: {
                      line1: 'line1',
                      line2: 'line2',
                      city: 'city',
                      postcode: 'bb127nq'
                    }
                  }
                ],
                defendants: [
                  {
                    type: 'company',
                    name: 'John Doe Ltd',
                    contactPerson: 'John Doe',
                    address: {
                      line1: 'line1',
                      line2: 'line2',
                      city: 'city',
                      postcode: 'bb127nq'
                    }
                  }
                ],
                payment: {
                  id: '12',
                  amount: 2500,
                  state: { status: 'failed' }
                },
                amount: {
                  type: 'breakdown',
                  rows: [{ reason: 'Reason', amount: 200 }]
                },
                interest: {
                  type: ClaimInterestType.STANDARD,
                  rate: 10,
//.........这里部分代码省略.........
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:101,代码来源:check-and-send.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap