Skip to content

Commit 9b781f0

Browse files
committed
tests: flatten describe blocks
1 parent c5be6b4 commit 9b781f0

File tree

2 files changed

+35
-36
lines changed

2 files changed

+35
-36
lines changed

src/lib/changelog/__snapshots__/index.spec.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`.render() markdown renderer option renders release changelog for the current release series 1`] = `
3+
exports[`.render() with markdown renders release changelog for the current release series 1`] = `
44
"#### BREAKING CHANGES
55
66
- shasha# a
@@ -32,7 +32,7 @@ exports[`.render() markdown renderer option renders release changelog for the cu
3232
"
3333
`;
3434

35-
exports[`.render() termimal renderer option renders changelog for the current release series 1`] = `
35+
exports[`.render() with termimal renders changelog for the current release series 1`] = `
3636
"BREAKING CHANGES
3737
3838
shasha# a

src/lib/changelog/index.spec.ts

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,41 @@ const mockCommits: Release.MockCommit[] = [
1616
{ message: 'feat: blah', version: '0.1.0' },
1717
]
1818

19-
describe('.render()', () => {
20-
describe('markdown renderer option', () => {
21-
const render = (...commits: Release.MockCommit[]) => {
22-
return Changelog.Renderers.Markdown.render(Changelog.fromSeries(Release.fromMockCommits(commits)))
23-
}
24-
it('renders release changelog for the current release series', () => {
25-
const changelog = render(...mockCommits)
26-
expect(changelog).toMatchSnapshot()
27-
})
28-
it('shows breaking commits twice, once in breaking section and once in its native section', () => {
29-
const changelog = render({ message: 'a: foo\n\nBREAKING CHANGE:\nbar' })
30-
expect(changelog).toMatch(/BREAKING CHANGES\n\n.*foo/)
31-
expect(changelog).toMatch(/Improvements\n\n.*foo/)
32-
})
33-
it('shows breaking label if commit breaking except within breaking section', () => {
34-
const changelog = render({ message: 'a: foo\n\nBREAKING CHANGE:\nbar' })
35-
expect(changelog).toMatch(/Improvements\n\n.*(breaking).*foo/)
36-
})
37-
it('hides unknown section if no unknown commits', () => {
38-
const changelog = render({ message: 'a: b' })
39-
expect(changelog).not.toMatch(Changelog.empty().unspecified.label)
40-
})
41-
it('improvements section prefixes commits with their type', () => {
42-
const changelog = render({ message: 'a: foo' })
43-
expect(changelog).toMatch(/a: foo/)
44-
})
19+
describe('.render() with markdown', () => {
20+
const render = (...commits: Release.MockCommit[]) => {
21+
// return Changelog.Renderers.Markdown.render(Changelog.fromSeries(Release.fromMockCommits(commits)))
22+
return Changelog.render(Changelog.fromSeries(Release.fromMockCommits(commits)), { as: 'markdown' })
23+
}
24+
it('renders release changelog for the current release series', () => {
25+
const changelog = render(...mockCommits)
26+
expect(changelog).toMatchSnapshot()
4527
})
28+
it('shows breaking commits twice, once in breaking section and once in its native section', () => {
29+
const changelog = render({ message: 'a: foo\n\nBREAKING CHANGE:\nbar' })
30+
expect(changelog).toMatch(/BREAKING CHANGES\n\n.*foo/)
31+
expect(changelog).toMatch(/Improvements\n\n.*foo/)
32+
})
33+
it('shows breaking label if commit breaking except within breaking section', () => {
34+
const changelog = render({ message: 'a: foo\n\nBREAKING CHANGE:\nbar' })
35+
expect(changelog).toMatch(/Improvements\n\n.*(breaking).*foo/)
36+
})
37+
it('hides unknown section if no unknown commits', () => {
38+
const changelog = render({ message: 'a: b' })
39+
expect(changelog).not.toMatch(Changelog.empty().unspecified.label)
40+
})
41+
it('improvements section prefixes commits with their type', () => {
42+
const changelog = render({ message: 'a: foo' })
43+
expect(changelog).toMatch(/a: foo/)
44+
})
45+
})
4646

47-
describe('termimal renderer option', () => {
48-
const render = (...commits: Release.MockCommit[]) => {
49-
return Changelog.Renderers.Terminal.render(Changelog.fromSeries(Release.fromMockCommits(commits)))
50-
}
47+
describe('.render() with termimal', () => {
48+
const render = (...commits: Release.MockCommit[]) => {
49+
return Changelog.render(Changelog.fromSeries(Release.fromMockCommits(commits)), { as: 'plain' })
50+
}
5151

52-
it('renders changelog for the current release series', () => {
53-
const changelog = stripAnsi(render(...mockCommits))
54-
expect(changelog).toMatchSnapshot()
55-
})
52+
it('renders changelog for the current release series', () => {
53+
const changelog = stripAnsi(render(...mockCommits))
54+
expect(changelog).toMatchSnapshot()
5655
})
5756
})

0 commit comments

Comments
 (0)