-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add smoke test for monitor command
- Loading branch information
Showing
2 changed files
with
49 additions
and
1 deletion.
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
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,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 |