@@ -7,84 +7,86 @@ import { readLastChangesFromStream } from './changelog.js'
77const dirname = fileURLToPath ( new URL ( '.' , import . meta. url ) )
88const mocks = path . join ( dirname , '..' , 'test' , 'mocks' )
99
10- describe ( 'changelog' , ( ) => {
11- describe ( 'readLastChangesFromStream' , ( ) => {
12- it ( 'should read last changes from file' , async ( ) => {
13- const stream = fs . createReadStream ( path . join ( mocks , 'CHANGELOG_0.md' ) )
14-
15- expect ( await readLastChangesFromStream ( stream ) ) . toMatchInlineSnapshot ( `
16- [
17- "8.0.0-alpha.2",
18- "### Bug Fixes
19-
20- * **deps:** update dependency dotenv to v11 ([#16](https://github.com/TrigenSoftware/scripts/issues/16)) ([27e4ce7](https://github.com/TrigenSoftware/scripts/commit/27e4ce7414f6d50fec9fe363238d771cf49b4cd7))
21-
22- ### Features
23-
24- * **browserslist-config:** update queries, add esm queries ([3031c6b](https://github.com/TrigenSoftware/scripts/commit/3031c6b322330be57654bdebc1012bddc20e7972))
25- ",
26- ]
27- ` )
28- } )
29-
30- it ( 'should read last changes from file with header' , async ( ) => {
31- const stream = fs . createReadStream ( path . join ( mocks , 'CHANGELOG_0.md' ) )
32- const options = {
33- includeTitle : true
34- }
35-
36- expect ( await readLastChangesFromStream ( stream , options ) ) . toMatchInlineSnapshot ( `
37- [
38- "8.0.0-alpha.2",
39- "# [8.0.0-alpha.2](https://github.com/TrigenSoftware/scripts/compare/v8.0.0-alpha.1...v8.0.0-alpha.2) (2022-01-14)
40-
41- ### Bug Fixes
42-
43- * **deps:** update dependency dotenv to v11 ([#16](https://github.com/TrigenSoftware/scripts/issues/16)) ([27e4ce7](https://github.com/TrigenSoftware/scripts/commit/27e4ce7414f6d50fec9fe363238d771cf49b4cd7))
44-
45- ### Features
46-
47- * **browserslist-config:** update queries, add esm queries ([3031c6b](https://github.com/TrigenSoftware/scripts/commit/3031c6b322330be57654bdebc1012bddc20e7972))
48- ",
49- ]
50- ` )
51- } )
52-
53- it ( 'should split titile without link' , async ( ) => {
54- const stream = fs . createReadStream ( path . join ( mocks , 'CHANGELOG_1.md' ) )
55-
56- expect ( await readLastChangesFromStream ( stream ) ) . toMatchInlineSnapshot ( `
57- [
58- "0.0.1-1",
59- "### Bug Fixes
60-
61- * **cli:** fix config file loading ([8603c2f](https://github.com/TrigenSoftware/simple-github-release/commit/8603c2fde4aeb53619fae8bb9feba53093f51c65))
62- ",
63- ]
64- ` )
65- } )
66-
67- it ( 'should read keep a changelog' , async ( ) => {
68- const stream = fs . createReadStream ( path . join ( mocks , 'CHANGELOG_2.md' ) )
69-
70- expect ( await readLastChangesFromStream ( stream ) ) . toMatchInlineSnapshot ( `
71- [
72- "1.0.0",
73- "### Added
74- - Version navigation.
75- - Links to latest released version in previous versions.
76- - "Why keep a changelog?" section.
77-
78- ### Changed
79- - Start using "changelog" over "change log" since it's the common usage.
80- - Start versioning based on the current English version at 0.3.0 to help
81- translation authors keep things up-to-date.
82-
83- ### Removed
84- - Section about "changelog" vs "CHANGELOG".
85- ",
86- ]
87- ` )
10+ describe ( 'simple-github-release' , ( ) => {
11+ describe ( 'changelog' , ( ) => {
12+ describe ( 'readLastChangesFromStream' , ( ) => {
13+ it ( 'should read last changes from file' , async ( ) => {
14+ const stream = fs . createReadStream ( path . join ( mocks , 'CHANGELOG_0.md' ) )
15+
16+ expect ( await readLastChangesFromStream ( stream ) ) . toMatchInlineSnapshot ( `
17+ [
18+ "8.0.0-alpha.2",
19+ "### Bug Fixes
20+
21+ * **deps:** update dependency dotenv to v11 ([#16](https://github.com/TrigenSoftware/scripts/issues/16)) ([27e4ce7](https://github.com/TrigenSoftware/scripts/commit/27e4ce7414f6d50fec9fe363238d771cf49b4cd7))
22+
23+ ### Features
24+
25+ * **browserslist-config:** update queries, add esm queries ([3031c6b](https://github.com/TrigenSoftware/scripts/commit/3031c6b322330be57654bdebc1012bddc20e7972))
26+ ",
27+ ]
28+ ` )
29+ } )
30+
31+ it ( 'should read last changes from file with header' , async ( ) => {
32+ const stream = fs . createReadStream ( path . join ( mocks , 'CHANGELOG_0.md' ) )
33+ const options = {
34+ includeTitle : true
35+ }
36+
37+ expect ( await readLastChangesFromStream ( stream , options ) ) . toMatchInlineSnapshot ( `
38+ [
39+ "8.0.0-alpha.2",
40+ "# [8.0.0-alpha.2](https://github.com/TrigenSoftware/scripts/compare/v8.0.0-alpha.1...v8.0.0-alpha.2) (2022-01-14)
41+
42+ ### Bug Fixes
43+
44+ * **deps:** update dependency dotenv to v11 ([#16](https://github.com/TrigenSoftware/scripts/issues/16)) ([27e4ce7](https://github.com/TrigenSoftware/scripts/commit/27e4ce7414f6d50fec9fe363238d771cf49b4cd7))
45+
46+ ### Features
47+
48+ * **browserslist-config:** update queries, add esm queries ([3031c6b](https://github.com/TrigenSoftware/scripts/commit/3031c6b322330be57654bdebc1012bddc20e7972))
49+ ",
50+ ]
51+ ` )
52+ } )
53+
54+ it ( 'should split titile without link' , async ( ) => {
55+ const stream = fs . createReadStream ( path . join ( mocks , 'CHANGELOG_1.md' ) )
56+
57+ expect ( await readLastChangesFromStream ( stream ) ) . toMatchInlineSnapshot ( `
58+ [
59+ "0.0.1-1",
60+ "### Bug Fixes
61+
62+ * **cli:** fix config file loading ([8603c2f](https://github.com/TrigenSoftware/simple-github-release/commit/8603c2fde4aeb53619fae8bb9feba53093f51c65))
63+ ",
64+ ]
65+ ` )
66+ } )
67+
68+ it ( 'should read keep a changelog' , async ( ) => {
69+ const stream = fs . createReadStream ( path . join ( mocks , 'CHANGELOG_2.md' ) )
70+
71+ expect ( await readLastChangesFromStream ( stream ) ) . toMatchInlineSnapshot ( `
72+ [
73+ "1.0.0",
74+ "### Added
75+ - Version navigation.
76+ - Links to latest released version in previous versions.
77+ - "Why keep a changelog?" section.
78+
79+ ### Changed
80+ - Start using "changelog" over "change log" since it's the common usage.
81+ - Start versioning based on the current English version at 0.3.0 to help
82+ translation authors keep things up-to-date.
83+
84+ ### Removed
85+ - Section about "changelog" vs "CHANGELOG".
86+ ",
87+ ]
88+ ` )
89+ } )
8890 } )
8991 } )
9092} )
0 commit comments