本文整理汇总了TypeScript中test/routes/authorization-check.checkAuthorizationGuards函数的典型用法代码示例。如果您正苦于以下问题:TypeScript checkAuthorizationGuards函数的具体用法?TypeScript checkAuthorizationGuards怎么用?TypeScript checkAuthorizationGuards使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkAuthorizationGuards函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('delete a date', () => {
const deletePath = Paths.hearingDatesDeleteReceiver.evaluateUri({ externalId: externalId, index: 'date-1' })
const method = 'get'
checkAuthorizationGuards(app, method, deletePath)
checkAccessGuard(app, method, deletePath)
context('when user authorised', () => {
beforeEach(() => {
idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
})
it('should redirect to the hearing dates page', async () => {
claimStoreServiceMock.resolveRetrieveClaimByExternalId(claim)
draftStoreServiceMock.resolveFind('directionsQuestionnaire', {
availability: {
hasUnavailableDates: true,
unavailableDates: unavailableDates
}
})
draftStoreServiceMock.resolveFind('response')
draftStoreServiceMock.resolveSave()
await request(app)
.get(deletePath)
.set('Cookie', `${cookieName}=ABC`)
.expect(res => expect(res).to.be.redirect.toLocation(hearingDatesPath))
})
})
})
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:30,代码来源:hearing-dates-picker.ts
示例2: describe
describe('on GET', () => {
const method = 'get'
checkAuthorizationGuards(app, method, pagePath)
checkNotClaimantInCaseGuard(app, method, pagePath)
context('when user authorised', () => {
beforeEach(() => {
idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
})
it('should return 500 and render error page when cannot retrieve claims', 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 () => {
claimStoreServiceMock.resolveRetrieveClaimByExternalId()
draftStoreServiceMock.resolveFind('paidInFull')
await request(app)
.get(pagePath)
.set('Cookie', `${cookieName}=ABC`)
.expect(res => expect(res).to.be.successful.withText('When did you settle the claim?'))
})
})
})
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:30,代码来源:date-paid.ts
示例3: describe
describe('on GET', () => {
const method = 'get'
checkAuthorizationGuards(app, method, pagePath)
checkNotDefendantInCaseGuard(app, method, pagePath)
context('when user authorised', () => {
beforeEach(() => {
idamServiceMock.resolveRetrieveUserFor(claimStoreServiceMock.sampleClaimObj.defendantId, 'citizen', 'defendant')
})
checkAlreadySubmittedGuard(app, method, pagePath)
checkCountyCourtJudgmentRequestedGuard(app, method, pagePath)
checkErrorHandling(method)
it('should render page when everything is fine', async () => {
claimStoreServiceMock.resolveRetrieveClaimByExternalId()
draftStoreServiceMock.resolveFind('response:full-admission')
await request(app)
.get(pagePath)
.set('Cookie', `${cookieName}=ABC`)
.expect(res => expect(res).to.be.successful.withText('Debts youâre behind on'))
})
})
})
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:25,代码来源:priority-debt.ts
示例4: describe
describe('on GET', () => {
checkAuthorizationGuards(app, 'get', incompleteSubmissionPagePath)
it('should render page when everything is fine', async () => {
idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
draftStoreServiceMock.resolveFind('claimantResponse')
draftStoreServiceMock.resolveFind('mediation')
claimStoreServiceMock.resolveRetrieveClaimByExternalId(defendantPartialAdmissionResponse)
await request(app)
.get(taskListPagePath)
.set('Cookie', `${cookieName}=ABC`)
.expect(res => expect(res).to.be.successful.withText('Your response'))
})
})
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:15,代码来源:task-list.ts
示例5: describe
describe('on GET', () => {
checkAuthorizationGuards(app, 'get', pagePath)
context('when user authorised', () => {
beforeEach(() => {
idamServiceMock.resolveRetrieveUserFor('100', 'citizen')
})
it('should render page when everything is fine', async () => {
await request(app)
.get(pagePath)
.set('Cookie', `${cookieName}=ABC`)
.expect(res => expect(res).to.be.successful.withText(pageText))
})
})
})
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:16,代码来源:create-claim-draft.ts
示例6: describe
describe('on Get', () => {
const method = 'get'
checkAuthorizationGuards(app, method, pagePath)
checkAccessGuard(app, method)
context('when user authorised', () => {
beforeEach(() => {
idamServiceMock.resolveRetrieveUserFor('1', 'citizen')
})
it('should return 500 and render error page when cannot retrieve claims', 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 return 500 and render error page when cannot retrieve directions questionnaire draft', async () => {
claimStoreServiceMock.resolveRetrieveClaimByExternalId(claimWithDQ)
draftStoreServiceMock.rejectFind('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 () => {
claimStoreServiceMock.resolveRetrieveClaimByExternalId(claimWithDQ)
draftStoreServiceMock.resolveFind('directionsQuestionnaire')
draftStoreServiceMock.resolveFind('response')
await request(app)
.get(pagePath)
.set('Cookie', `${cookieName}=ABC`)
.expect(res => expect(res).to.be.successful.withText('Does the claim involve something an expert can still examine?'))
})
})
})
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:41,代码来源:expert-evidence.ts
示例7: checkAuthorizationGuards
export function checkAuthorizationGuards (app: any, method: string, pagePath: string) {
check(app, method, pagePath)
}
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:3,代码来源:authorization-check.ts
注:本文中的test/routes/authorization-check.checkAuthorizationGuards函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论