it('should render page when both defendant and claimants payment frequency are same', async () => {
        claimStoreServiceMock.resolveRetrieveClaimByExternalId(claimStoreServiceMock.sampleFullAdmissionWithPaymentByInstalmentsResponseObj)
        draftStoreServiceMock.resolveFind('claimantResponse', {
          acceptPaymentMethod: {
            accept: {
              option: 'no'
            }
          },
          alternatePaymentMethod: {
            paymentOption: {
              option: {
                value: 'INSTALMENTS'
              }
            },
            paymentPlan: {
              totalAmount: 1060,
              instalmentAmount: 1,
              firstPaymentDate: {
                year: 2019,
                month: 1,
                day: 1
              },
              paymentSchedule: PaymentSchedule.EACH_WEEK
            }
          },
          courtOfferedPaymentIntention: {
            paymentOption: {
              value: 'INSTALMENTS'
            },
            repaymentPlan: {
              instalmentAmount: 4.3333335,
              firstPaymentDate: '2019-01-01T00:00:00.000',
              paymentSchedule: 'EVERY_MONTH',
              completionDate: MomentFactory.parse('2039-05-08T00:00:00.000'),
              paymentLength: '20 years 5 months'
            }
          },
          courtDecisionType: 'CLAIMANT'
        })

        await request(app)
          .get(pagePath)
          .set('Cookie', `${cookieName}=ABC`)
          .expect(res => expect(res).to.be.successful.withText('The court has accepted your repayment plan'))
      })
  it("should return the two result start with offset 5", function(done){

    request(app)
    .get("/paginationCustom/666?limite=2&index=5")
    .expect(function(res) {
      console.log(res.body);
      let expected = { _links:
        { self: {
          href:"/paginationCustom/666?limite=2&index=5"}
        }, data: [{firstName:"Bruce", lastName:"Banner", secretIdentity: "Hulk", offset:"5"},
                {firstName:"Natasha", lastName:"Romanoff", secretIdentity: "Black Widow", offset:"6"}]}

      assert.equal(res.body._links.self.href, expected._links.self.href);
      assert.equal(res.body.data.length, expected.data.length);

      DataHelper.testData(res.body.data, expected.data, 5, 2);
    }).end(done);
  });
Esempio n. 3
0
function addVideoChannel (url: string, token: string, videoChannelAttributesArg: VideoChannelAttributes, expectedStatus = 200) {
  const path = '/api/v1/videos/channels'

  // Default attributes
  let attributes = {
    name: 'my super video channel',
    description: 'my super channel description',
    support: 'my super channel support'
  }
  attributes = Object.assign(attributes, videoChannelAttributesArg)

  return request(url)
    .post(path)
    .send(attributes)
    .set('Accept', 'application/json')
    .set('Authorization', 'Bearer ' + token)
    .expect(expectedStatus)
}
        it('should trigger validation when no schedule is given', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')

          await request(app)
            .post(pagePath)
            .send({
              mortgage: {
                amount: 100
              },
              rent: {
                amount: 700
              }
            })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.successful.withText('Select how often you pay for mortgage'))
            .expect(res => expect(res).to.be.successful.withText('Select how often you pay for rent'))
        })
        it('should trigger validation when no amount is given', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId()
          draftStoreServiceMock.resolveFind('response:full-admission')

          await request(app)
            .post(pagePath)
            .send({
              mortgage: {
                schedule: IncomeExpenseSchedule.MONTH.value
              },
              rent: {
                schedule: IncomeExpenseSchedule.MONTH.value
              }
            })
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.successful.withText('Enter how much you pay for mortgage'))
            .expect(res => expect(res).to.be.successful.withText('Enter how much you pay for rent'))
        })
 it('should return 201', function (done) {
     configureNock();
     let test_input = { "id": "test-create-doc" }
     request(app.server)
         .post('/docs')
         .set('x-ms-masterkey', 'testing-create')
         .set('x-ms-dbs', 'testingDB')
         .set('x-ms-colls', 'testingColls')
         .set('x-ms-account', 'test')
         .send(test_input)
         .expect(201)
         .end(function (err, res) {
             should.not.exist(err);
             should.exist(res.header['x-ms-doc-id']);
             res.body.id.should.equal('AndersenFamily');
             done();
         });
 });
Esempio n. 7
0
 it('POST /registration/GetAllUsers', (done) => {
     request(baseUrl)
         .post('/registration/user/GetAllUsers')
         .send({
             'PageContext': {
                 'PageSize': 100,
                 'PageNumber': 1
             },
             'Params': null
         })
         .set('Accept', 'application/json')
         .expect('Content-Type', /json/)
         .expect(200)
         .end(function (err: any, res: any) {
             if (err) throw err;
             done();
         });
 });
Esempio n. 8
0
  it("should return the first three result", function (done) {

    request(app)
      .get("/pagination?pageSize=3&pageIdx=0")
      .expect(function (res) {
        let expected = {
          data: [
            { firstName: "Peter", lastName: "Parker", secretIdentity: "Spiderman", offset: "0" },
            { firstName: "Bruce", lastName: "Wayne", secretIdentity: "Batman", offset: "1" },
            { firstName: "Clark", lastName: "Kent", secretIdentity: "Superman", offset: "2" }
          ]
        };

        assert.equal(res.body.data.length, expected.data.length);
        DataHelper.testData(res.body.data, expected.data, 0, 3);

      }).end(done);
  });
          it('should redirect to confirmation page when form is valid and a non handoff response type is picked', async () => {
            draftStoreServiceMock.resolveFind(draftType)
            draftStoreServiceMock.resolveFind('mediation')
            claimStoreServiceMock.resolveRetrieveClaimByExternalId()
            claimStoreServiceMock.resolveSaveResponse()
            draftStoreServiceMock.resolveDelete()

            if (FeatureToggles.isEnabled('mediation')) {
              draftStoreServiceMock.resolveDelete()
            }

            await request(app)
              .post(pagePath)
              .set('Cookie', `${cookieName}=ABC`)
              .send({ signed: 'true', type: SignatureType.BASIC })
              .expect(res => expect(res).to.be.redirect
                .toLocation(ResponsePaths.confirmationPage.evaluateUri({ externalId: claimStoreServiceMock.sampleClaimObj.externalId })))
          })
Esempio n. 10
0
        it('should render page with pre-selected dates', async () => {
          claimStoreServiceMock.resolveRetrieveClaimByExternalId(claim)
          draftStoreServiceMock.resolveFind('directionsQuestionnaire', {
            availability: {
              hasUnavailableDates: true,
              unavailableDates: [{ year: 2018, month: 1, day: 1 }, { year: 2018, month: 1, day: 5 }]
            }
          })
          draftStoreServiceMock.resolveFind('response')

          await request(app)
            .get(pagePath)
            .set('Cookie', `${cookieName}=ABC`)
            .expect(res => expect(res).to.be.successful.withText(
              '1 January 2018',
              '5 January 2018'
            ))
        })