Skip to content

Commit

Permalink
#34 - Introduce unit tests (#35)
Browse files Browse the repository at this point in the history
#34 - Introduce unit tests
- Implemented unit tests and mock logic.
- Rework of exit calls and exception throwing to use core.setFailed().
- Fix failing usage in yml file.
- Fixed bug in PR before 'since' decision logic.
  • Loading branch information
miroslavpojer authored Jan 25, 2024
1 parent ec6751f commit 6acadaf
Show file tree
Hide file tree
Showing 18 changed files with 2,618 additions and 831 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ npm run build

Then, commit action.yml and dist/index.js to your repository.

### Run unit test
First install [jest](https://jestjs.io/) testing framework.
```
npm install --save-dev jest
npm install @actions/core
npm install @actions/github
```
Launch unit tests.
```
npm test
```
## Features
### Release Notes Extraction Process
Expand Down
29 changes: 29 additions & 0 deletions __tests__/data/rls_notes_empty_with_all_chapters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
### Breaking Changes 💥
No entries detected.

### New Features 🎉
No entries detected.

### Bugfixes 🛠
No entries detected.

### Closed Issues without Pull Request ⚠️
All closed issues linked to a Pull Request.

### Closed Issues without User Defined Labels ⚠️
All closed issues contain at least one of user defined labels.

### Closed Issues without Release Notes ⚠️
All closed issues have release notes.

### Merged PRs without Linked Issue ⚠️
All merged PRs are linked to issues.

### Merged PRs Linked to Open Issue ⚠️
All merged PRs are linked to Closed issues.

### Closed PRs without Linked Issue ⚠️
All closed PRs are linked to issues.

#### Full Changelog
https://github.com/owner/repo/commits/v0.1.1
2 changes: 2 additions & 0 deletions __tests__/data/rls_notes_empty_with_hidden_empty_chapters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#### Full Changelog
https://github.com/owner/repo/commits/v0.1.1
11 changes: 11 additions & 0 deletions __tests__/data/rls_notes_empty_with_hidden_warning_chapters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Breaking Changes 💥
No entries detected.

### New Features 🎉
No entries detected.

### Bugfixes 🛠
No entries detected.

#### Full Changelog
https://github.com/owner/repo/commits/v0.1.1
20 changes: 20 additions & 0 deletions __tests__/data/rls_notes_empty_with_no_custom_chapters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Closed Issues without Pull Request ⚠️
All closed issues linked to a Pull Request.

### Closed Issues without User Defined Labels ⚠️
All closed issues contain at least one of user defined labels.

### Closed Issues without Release Notes ⚠️
All closed issues have release notes.

### Merged PRs without Linked Issue ⚠️
All merged PRs are linked to issues.

### Merged PRs Linked to Open Issue ⚠️
All merged PRs are linked to Closed issues.

### Closed PRs without Linked Issue ⚠️
All closed PRs are linked to issues.

#### Full Changelog
https://github.com/owner/repo/commits/v0.1.1
54 changes: 54 additions & 0 deletions __tests__/data/rls_notes_fully_populated_custom_skip_label.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
### Breaking Changes 💥
- #8 _Issue title 8 - with co-author|private mail_ implemented by @johnDoe, Jane Doe in [#8](link-to-pr-8)
- note about change in Issue 8
- #7 _Issue title 7 - with co-author|public mail_ implemented by @janeDoe, @johnDoe in [#7](link-to-pr-7)
- note about change in Issue 7


### New Features 🎉
- #6 _Issue title 6 - not assigned|no PR_ implemented by "Missing Assignee or Contributor"
- note about change in Issue 6
- #4 _Issue title 4 - assigned|one PR_ implemented by @johnDoe in [#4](link-to-pr-4)
- note about change in Issue 4
- #2 _Issue title 2_ implemented by @johnDoe in [#2](link-to-pr-2)
- note about change in Issue 2


### Bugfixes 🛠
- #1 _Issue title 1_ implemented by @janeDoe in [#1](link-to-pr-1)
- note about change in Issue 1


### Closed Issues without Pull Request ⚠️
- #10 _Issue title 10 - skip label_ implemented by @janeDoe
- #6 _Issue title 6 - not assigned|no PR_ implemented by "Missing Assignee or Contributor"
- note about change in Issue 6


### Closed Issues without User Defined Labels ⚠️
- #10 _Issue title 10 - skip label_ implemented by @janeDoe
- #9 _Issue title 9 - no user defined label_ implemented by @janeDoe in [#9](link-to-pr-9)
- note about change in Issue 9
- #3 _Issue title 3 - no release note comment|typo label_ implemented by @janeDoe in [#3](link-to-pr-3)


### Closed Issues without Release Notes ⚠️
- #10 _Issue title 10 - skip label_ implemented by @janeDoe
- #3 _Issue title 3 - no release note comment|typo label_ implemented by @janeDoe in [#3](link-to-pr-3)


### Merged PRs without Linked Issue ⚠️
#1004 _Pull Request 4 - no linked issue - merged_
#1006 _Pull Request 6 - skip label_


### Merged PRs Linked to Open Issue ⚠️
#1003 _Pull Request 3 - linked to open issue_


### Closed PRs without Linked Issue ⚠️
#1002 _Pull Request 2 - no linked issue - closed_


#### Full Changelog
https://github.com/owner/repo/compare/v0.1.0...v0.1.1
53 changes: 53 additions & 0 deletions __tests__/data/rls_notes_fully_populated_first_release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
### Breaking Changes 💥
- #8 _Issue title 8 - with co-author|private mail_ implemented by @johnDoe, Jane Doe in [#8](link-to-pr-8)
- note about change in Issue 8
- #7 _Issue title 7 - with co-author|public mail_ implemented by @janeDoe, @johnDoe in [#7](link-to-pr-7)
- note about change in Issue 7


### New Features 🎉
- #6 _Issue title 6 - not assigned|no PR_ implemented by "Missing Assignee or Contributor"
- note about change in Issue 6
- #5 _Issue title 5 - not assigned|three PRs_ implemented by "Missing Assignee or Contributor" in [#5](link-to-pr-5), [#15](link-to-pr-15), [#16](link-to-pr-16)
- note about change in Issue 5
- #4 _Issue title 4 - assigned|one PR_ implemented by @johnDoe in [#4](link-to-pr-4)
- note about change in Issue 4
- #2 _Issue title 2_ implemented by @johnDoe in [#2](link-to-pr-2)
- note about change in Issue 2


### Bugfixes 🛠
- #1 _Issue title 1_ implemented by @janeDoe in [#1](link-to-pr-1)
- note about change in Issue 1


### Closed Issues without Pull Request ⚠️
- #6 _Issue title 6 - not assigned|no PR_ implemented by "Missing Assignee or Contributor"
- note about change in Issue 6


### Closed Issues without User Defined Labels ⚠️
- #9 _Issue title 9 - no user defined label_ implemented by @janeDoe in [#9](link-to-pr-9)
- note about change in Issue 9
- #3 _Issue title 3 - no release note comment|typo label_ implemented by @janeDoe in [#3](link-to-pr-3)


### Closed Issues without Release Notes ⚠️
- #3 _Issue title 3 - no release note comment|typo label_ implemented by @janeDoe in [#3](link-to-pr-3)


### Merged PRs without Linked Issue ⚠️
#1001 _Pull Request 1_
#1004 _Pull Request 4 - no linked issue - merged_


### Merged PRs Linked to Open Issue ⚠️
#1003 _Pull Request 3 - linked to open issue_


### Closed PRs without Linked Issue ⚠️
#1002 _Pull Request 2 - no linked issue - closed_


#### Full Changelog
https://github.com/owner/repo-no-rls/commits/v0.1.1
25 changes: 25 additions & 0 deletions __tests__/data/rls_notes_fully_populated_hide_warning_chapters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### Breaking Changes 💥
- #8 _Issue title 8 - with co-author|private mail_ implemented by @johnDoe, Jane Doe in [#8](link-to-pr-8)
- note about change in Issue 8
- #7 _Issue title 7 - with co-author|public mail_ implemented by @janeDoe, @johnDoe in [#7](link-to-pr-7)
- note about change in Issue 7


### New Features 🎉
- #6 _Issue title 6 - not assigned|no PR_ implemented by "Missing Assignee or Contributor"
- note about change in Issue 6
- #5 _Issue title 5 - not assigned|three PRs_ implemented by "Missing Assignee or Contributor" in [#5](link-to-pr-5), [#15](link-to-pr-15), [#16](link-to-pr-16)
- note about change in Issue 5
- #4 _Issue title 4 - assigned|one PR_ implemented by @johnDoe in [#4](link-to-pr-4)
- note about change in Issue 4
- #2 _Issue title 2_ implemented by @johnDoe in [#2](link-to-pr-2)
- note about change in Issue 2


### Bugfixes 🛠
- #1 _Issue title 1_ implemented by @janeDoe in [#1](link-to-pr-1)
- note about change in Issue 1


#### Full Changelog
https://github.com/owner/repo/compare/v0.1.0...v0.1.1
53 changes: 53 additions & 0 deletions __tests__/data/rls_notes_fully_populated_in_default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
### Breaking Changes 💥
- #8 _Issue title 8 - with co-author|private mail_ implemented by @johnDoe, Jane Doe in [#8](link-to-pr-8)
- note about change in Issue 8
- #7 _Issue title 7 - with co-author|public mail_ implemented by @janeDoe, @johnDoe in [#7](link-to-pr-7)
- note about change in Issue 7


### New Features 🎉
- #6 _Issue title 6 - not assigned|no PR_ implemented by "Missing Assignee or Contributor"
- note about change in Issue 6
- #5 _Issue title 5 - not assigned|three PRs_ implemented by "Missing Assignee or Contributor" in [#5](link-to-pr-5), [#15](link-to-pr-15), [#16](link-to-pr-16)
- note about change in Issue 5
- #4 _Issue title 4 - assigned|one PR_ implemented by @johnDoe in [#4](link-to-pr-4)
- note about change in Issue 4
- #2 _Issue title 2_ implemented by @johnDoe in [#2](link-to-pr-2)
- note about change in Issue 2


### Bugfixes 🛠
- #1 _Issue title 1_ implemented by @janeDoe in [#1](link-to-pr-1)
- note about change in Issue 1


### Closed Issues without Pull Request ⚠️
- #6 _Issue title 6 - not assigned|no PR_ implemented by "Missing Assignee or Contributor"
- note about change in Issue 6


### Closed Issues without User Defined Labels ⚠️
- #9 _Issue title 9 - no user defined label_ implemented by @janeDoe in [#9](link-to-pr-9)
- note about change in Issue 9
- #3 _Issue title 3 - no release note comment|typo label_ implemented by @janeDoe in [#3](link-to-pr-3)


### Closed Issues without Release Notes ⚠️
- #3 _Issue title 3 - no release note comment|typo label_ implemented by @janeDoe in [#3](link-to-pr-3)


### Merged PRs without Linked Issue ⚠️
#1001 _Pull Request 1_
#1004 _Pull Request 4 - no linked issue - merged_


### Merged PRs Linked to Open Issue ⚠️
#1003 _Pull Request 3 - linked to open issue_


### Closed PRs without Linked Issue ⚠️
#1002 _Pull Request 2 - no linked issue - closed_


#### Full Changelog
https://github.com/owner/repo/compare/v0.1.0...v0.1.1
44 changes: 44 additions & 0 deletions __tests__/data/rls_notes_fully_populated_no_custom_chapters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
### Closed Issues without Pull Request ⚠️
- #6 _Issue title 6 - not assigned|no PR_ implemented by "Missing Assignee or Contributor"
- note about change in Issue 6


### Closed Issues without User Defined Labels ⚠️
- #9 _Issue title 9 - no user defined label_ implemented by @janeDoe in [#9](link-to-pr-9)
- note about change in Issue 9
- #8 _Issue title 8 - with co-author|private mail_ implemented by @johnDoe, Jane Doe in [#8](link-to-pr-8)
- note about change in Issue 8
- #7 _Issue title 7 - with co-author|public mail_ implemented by @janeDoe, @johnDoe in [#7](link-to-pr-7)
- note about change in Issue 7
- #6 _Issue title 6 - not assigned|no PR_ implemented by "Missing Assignee or Contributor"
- note about change in Issue 6
- #5 _Issue title 5 - not assigned|three PRs_ implemented by "Missing Assignee or Contributor" in [#5](link-to-pr-5), [#15](link-to-pr-15), [#16](link-to-pr-16)
- note about change in Issue 5
- #4 _Issue title 4 - assigned|one PR_ implemented by @johnDoe in [#4](link-to-pr-4)
- note about change in Issue 4
- #3 _Issue title 3 - no release note comment|typo label_ implemented by @janeDoe in [#3](link-to-pr-3)
- #2 _Issue title 2_ implemented by @johnDoe in [#2](link-to-pr-2)
- note about change in Issue 2
- #1 _Issue title 1_ implemented by @janeDoe in [#1](link-to-pr-1)
- note about change in Issue 1


### Closed Issues without Release Notes ⚠️
- #3 _Issue title 3 - no release note comment|typo label_ implemented by @janeDoe in [#3](link-to-pr-3)


### Merged PRs without Linked Issue ⚠️
#1001 _Pull Request 1_
#1004 _Pull Request 4 - no linked issue - merged_


### Merged PRs Linked to Open Issue ⚠️
#1003 _Pull Request 3 - linked to open issue_


### Closed PRs without Linked Issue ⚠️
#1002 _Pull Request 2 - no linked issue - closed_


#### Full Changelog
https://github.com/owner/repo/compare/v0.1.0...v0.1.1
29 changes: 29 additions & 0 deletions __tests__/data/rls_notes_fully_populated_second_release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
### Breaking Changes 💥
No entries detected.

### New Features 🎉
No entries detected.

### Bugfixes 🛠
No entries detected.

### Closed Issues without Pull Request ⚠️
All closed issues linked to a Pull Request.

### Closed Issues without User Defined Labels ⚠️
All closed issues contain at least one of user defined labels.

### Closed Issues without Release Notes ⚠️
All closed issues have release notes.

### Merged PRs without Linked Issue ⚠️
All merged PRs are linked to issues.

### Merged PRs Linked to Open Issue ⚠️
All merged PRs are linked to Closed issues.

### Closed PRs without Linked Issue ⚠️
All closed PRs are linked to issues.

#### Full Changelog
https://github.com/owner/repo-2nd-rls/compare/v0.1.0...v0.1.1
Loading

0 comments on commit 6acadaf

Please sign in to comment.