-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: delete vuln paths option once transformed
Add tests for the setDefaultTestOptions()
- Loading branch information
Showing
4 changed files
with
104 additions
and
9 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
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,99 @@ | ||
import { setDefaultTestOptions } from '../src/cli/commands/test/set-default-test-options'; | ||
|
||
describe('setDefaultTestOptions', () => { | ||
it('defaults to show-vulnerable-paths:some & org from config when no options passed in', () => { | ||
const updated = setDefaultTestOptions({ path: '/' }); | ||
expect(updated).toEqual({ | ||
org: undefined, | ||
path: '/', | ||
showVulnPaths: 'some', | ||
}); | ||
}); | ||
|
||
it('with show-vulnerable-paths set to `false` => `none`', () => { | ||
const options = { | ||
path: '/', | ||
'show-vulnerable-paths': 'false', | ||
}; | ||
const updated = setDefaultTestOptions(options); | ||
expect(updated).toEqual({ | ||
org: undefined, | ||
path: '/', | ||
showVulnPaths: 'none', | ||
}); | ||
}); | ||
|
||
it('with show-vulnerable-paths as boolean => `some`', () => { | ||
const options = { | ||
path: '/', | ||
'show-vulnerable-paths': true, | ||
}; | ||
const updated = setDefaultTestOptions(options as any); | ||
expect(updated).toEqual({ | ||
org: undefined, | ||
path: '/', | ||
showVulnPaths: 'some', | ||
}); | ||
}); | ||
|
||
it('with show-vulnerable-paths set to `none` => `none`', () => { | ||
const options = { | ||
path: '/', | ||
'show-vulnerable-paths': 'none', | ||
}; | ||
const updated = setDefaultTestOptions(options); | ||
expect(updated).toEqual({ | ||
org: undefined, | ||
path: '/', | ||
showVulnPaths: 'none', | ||
}); | ||
}); | ||
|
||
it('with show-vulnerable-paths set to `true` => `some`', () => { | ||
const options = { | ||
path: '/', | ||
'show-vulnerable-paths': 'true', | ||
}; | ||
const updated = setDefaultTestOptions(options); | ||
expect(updated).toEqual({ | ||
org: undefined, | ||
path: '/', | ||
showVulnPaths: 'some', | ||
}); | ||
}); | ||
|
||
it('with show-vulnerable-paths set to `some` => `some`', () => { | ||
const options = { | ||
path: '/', | ||
'show-vulnerable-paths': 'some', | ||
}; | ||
const updated = setDefaultTestOptions(options); | ||
expect(updated).toEqual({ | ||
org: undefined, | ||
path: '/', | ||
showVulnPaths: 'some', | ||
}); | ||
}); | ||
|
||
it('with show-vulnerable-paths set to `all` => `all`', () => { | ||
const options = { | ||
path: '/', | ||
'show-vulnerable-paths': 'all', | ||
}; | ||
const updated = setDefaultTestOptions(options); | ||
expect(updated).toEqual({ | ||
org: undefined, | ||
path: '/', | ||
showVulnPaths: 'all', | ||
}); | ||
}); | ||
|
||
it('with org set', () => { | ||
const updated = setDefaultTestOptions({ path: '/', org: 'my-org' }); | ||
expect(updated).toEqual({ | ||
org: 'my-org', | ||
path: '/', | ||
showVulnPaths: 'some', | ||
}); | ||
}); | ||
}); |
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