-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: description is not rendered if doesn't containt markdown headings
fixes #591
- Loading branch information
1 parent
2ecc8bc
commit 90ed717
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { ApiInfoModel } from '../../models/ApiInfo'; | ||
import { OpenAPIParser } from '../../OpenAPIParser'; | ||
import { RedocNormalizedOptions } from '../../RedocNormalizedOptions'; | ||
|
||
const opts = new RedocNormalizedOptions({}); | ||
describe('Models', () => { | ||
describe('ResponseModel', () => { | ||
let parser: OpenAPIParser; | ||
|
||
beforeEach(() => { | ||
parser = new OpenAPIParser({ openapi: '3.0.0' } as any, undefined, opts); | ||
}); | ||
|
||
test('should correctly populate description field without md headings', () => { | ||
parser.spec = { | ||
openapi: '3.0.0', | ||
info: { | ||
description: 'Test description', | ||
}, | ||
} as any; | ||
|
||
const info = new ApiInfoModel(parser); | ||
expect(info.description).toEqual('Test description'); | ||
}); | ||
|
||
test('should correctly populate description up to the first md heading', () => { | ||
parser.spec = { | ||
openapi: '3.0.0', | ||
info: { | ||
description: 'Test description\nsome text\n## Heading\n test', | ||
}, | ||
} as any; | ||
|
||
const info = new ApiInfoModel(parser); | ||
expect(info.description).toEqual('Test description\nsome text\n'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters