本文整理汇总了TypeScript中supertest.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript supertest.default方法的具体用法?TypeScript supertest.default怎么用?TypeScript supertest.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类supertest
的用法示例。
在下文中一共展示了supertest.default方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: request
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'))
})
示例2: it
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);
});
示例3: addVideoChannel
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)
}
示例4: request
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'))
})
示例5: it
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();
});
});
示例6: it
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();
});
});
示例7: it
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);
});
示例8: request
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 })))
})
示例9: request
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'
))
})