Skip to content

Commit

Permalink
chore: add smoke test for monitor command
Browse files Browse the repository at this point in the history
  • Loading branch information
JackuB committed Sep 1, 2020
1 parent a99ac29 commit c470cec
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/smoke/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ CI=1 SMOKE_TESTS_SNYK_TOKEN=$SNYK_API_TOKEN shellspec -f d
- [x] test [--json][npm project]
- [ ] test [--json][java-goof]
- [ ] policy, ignore
- [ ] monitor
- [x] monitor [--json][npm project]
- [ ] monitor [--json][java-goof]
- [ ] wizard - possibly impossible? (maybe a basic test that it even loads)

### Missing environments
Expand Down
47 changes: 47 additions & 0 deletions test/smoke/spec/snyk_monitor_spec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#shellcheck shell=sh

Describe "Snyk monitor command"
Before snyk_login
After snyk_logout

Describe "monitor npm project"
run_monitor_in_subfolder() {
cd ../fixtures/basic-npm || return
snyk monitor
}

It "finds vulns in a project in the same folder"
When run run_monitor_in_subfolder
The status should be success
The output should include "Explore this snapshot at https://app.snyk.io/org/"
The output should include "Notifications about newly disclosed issues related to these dependencies will be emailed to you."
The stderr should equal ""
End

It "finds vulns in a project when pointing to a folder"
When run snyk monitor ../fixtures/basic-npm
The status should be success
The output should include "Explore this snapshot at https://app.snyk.io/org/"
The output should include "Notifications about newly disclosed issues related to these dependencies will be emailed to you."
The stderr should equal ""
End

It "finds vulns in a project when pointing to a file"
When run snyk monitor --file=../fixtures/basic-npm/package.json
The status should be success
The output should include "Explore this snapshot at https://app.snyk.io/org/"
The output should include "Notifications about newly disclosed issues related to these dependencies will be emailed to you."
The stderr should equal ""
End
End

Describe "monitor npm project with JSON output"
It "outputs a valid JSON with vulns"
When run snyk monitor ../fixtures/basic-npm --json
The status should be success # issues found
The output should include '"ok": true,'
The stderr should equal ""
The result of function check_valid_json should be success
End
End
End

0 comments on commit c470cec

Please sign in to comment.