Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
test: then & catch
Browse files Browse the repository at this point in the history
  • Loading branch information
hanspagel committed Jun 20, 2024
1 parent 6cddc37 commit 5f2feec
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions packages/openapi-parser/src/pipeline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,39 @@ describe('pipeline', () => {
'Can’t resolve reference: #/components/requestBodies/DoesNotExist',
)
})

it('works with then & catch', async () => {
return new Promise((resolve, reject) => {
openapi()
.load({
openapi: '3.1.0',
info: {
title: 'Hello World',
},
paths: {
'/foobar': {
post: {
requestBody: {
$ref: '#/components/requestBodies/DoesNotExist',
},
},
},
},
})
.validate({
throwOnError: true,
})
.get()
.then(() => {
reject()
})
.catch((error) => {
expect(error.message).toBe(
'Can’t resolve reference: #/components/requestBodies/DoesNotExist',
)

resolve(null)
})
})
})
})

0 comments on commit 5f2feec

Please sign in to comment.