-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add bashunit to the repo * chore: created folder for test and check that bashunit works * chore: snapshot for test_should_ignore_files_with_glob * chore: add pipeline * chore: snapshot update * git ignore bashunit, rather install it as vendor * chore: code style * chore: fix installed bashunit version --------- Co-authored-by: Chemaclass <[email protected]> Co-authored-by: katarn <[email protected]>
- Loading branch information
1 parent
d269449
commit 54c3c1d
Showing
8 changed files
with
129 additions
and
0 deletions.
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 @@ | ||
DEFAULT_PATH=tests |
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,13 @@ | ||
# Testing | ||
|
||
Tests written in [bashunit](https://bashunit.typeddevs.com/). | ||
|
||
Install vendor dependencies: | ||
```bash | ||
./install-dependencies.sh | ||
``` | ||
|
||
Run all tests: | ||
```bash | ||
./lib/bashunit tests | ||
``` |
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,19 @@ | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
name: Tests | ||
jobs: | ||
tests: | ||
name: "Run tests" | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: "Install dependencies" | ||
run: ./install-dependencies.sh | ||
|
||
- name: "Tests" | ||
run: ./lib/bashunit |
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,3 @@ | ||
.idea/ | ||
|
||
lib/bashunit |
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,4 @@ | ||
#!/bin/bash | ||
|
||
## bashunit | ||
curl -s https://bashunit.typeddevs.com/install.sh | bash -s -- lib 0.10.0 |
74 changes: 74 additions & 0 deletions
74
tests/fixtures/test_should_ignore_files_with_regex_response
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,74 @@ | ||
[ | ||
{ | ||
"filename": ".editorconfig", | ||
"additions": 9, | ||
"deletions": 0, | ||
"changes": 9 | ||
}, | ||
{ | ||
"filename": ".github/workflows/ci.yml", | ||
"additions": 17, | ||
"deletions": 0, | ||
"changes": 17 | ||
}, | ||
{ | ||
"filename": "asdasdasd.lock", | ||
"additions": 1188, | ||
"deletions": 0, | ||
"changes": 1188 | ||
}, | ||
{ | ||
"filename": "entrypoint.sh", | ||
"additions": 4, | ||
"deletions": 4, | ||
"changes": 8 | ||
}, | ||
{ | ||
"filename": "src/ensure.sh", | ||
"additions": 4, | ||
"deletions": 4, | ||
"changes": 8 | ||
}, | ||
{ | ||
"filename": "src/github.sh", | ||
"additions": 89, | ||
"deletions": 76, | ||
"changes": 165 | ||
}, | ||
{ | ||
"filename": "src/github_actions.sh", | ||
"additions": 1, | ||
"deletions": 1, | ||
"changes": 2 | ||
}, | ||
{ | ||
"filename": "src/inner.lock", | ||
"additions": 1188, | ||
"deletions": 0, | ||
"changes": 1188 | ||
}, | ||
{ | ||
"filename": "src/labeler.sh", | ||
"additions": 48, | ||
"deletions": 48, | ||
"changes": 96 | ||
}, | ||
{ | ||
"filename": "src/log.sh", | ||
"additions": 17, | ||
"deletions": 0, | ||
"changes": 17 | ||
}, | ||
{ | ||
"filename": "src/main.sh", | ||
"additions": 34, | ||
"deletions": 23, | ||
"changes": 57 | ||
}, | ||
{ | ||
"filename": "src/misc.sh", | ||
"additions": 10, | ||
"deletions": 14, | ||
"changes": 24 | ||
} | ||
] |
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,14 @@ | ||
#!/bin/bash | ||
|
||
function set_up() { | ||
source ./src/misc.sh | ||
source ./src/github.sh | ||
} | ||
|
||
function test_should_ignore_files_with_glob() { | ||
local -r pr_number=123 | ||
local -r files_to_ignore=("*.lock" ".editorconfig") | ||
mock curl cat ./tests/fixtures/test_should_ignore_files_with_regex_response | ||
|
||
assert_match_snapshot "$(github::calculate_total_modifications "$pr_number" "${files_to_ignore[*]}")" | ||
} |
1 change: 1 addition & 0 deletions
1
tests/snapshots/github_test_sh.test_should_ignore_files_with_glob.snapshot
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 @@ | ||
394 |