-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: snyk woof ro language support and tests
- Loading branch information
Showing
3 changed files
with
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ const woofs = { | |
cs: ' Haf!', | ||
uk: ' Гав!', | ||
de: 'Wuff!', | ||
ro: ' Ham!', | ||
cat: 'Meow?', | ||
}; | ||
|
||
|
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 |
---|---|---|
@@ -1,29 +1,46 @@ | ||
import { runSnykCLI } from '../util/runSnykCLI'; | ||
|
||
describe('woof', () => { | ||
// supported languages | ||
const languages = [ | ||
{ langCode: 'en', expectedWoof: 'Woof!' }, | ||
{ langCode: 'he', expectedWoof: 'בה! ' }, | ||
{ langCode: 'ru', expectedWoof: 'Гав!' }, | ||
{ langCode: 'es', expectedWoof: 'Guau!' }, | ||
{ langCode: 'cs', expectedWoof: 'Haf!' }, | ||
{ langCode: 'uk', expectedWoof: 'Гав!' }, | ||
{ langCode: 'de', expectedWoof: 'Wuff!' }, | ||
{ langCode: 'ro', expectedWoof: 'Ham!' }, | ||
{ langCode: 'cat', expectedWoof: 'Meow?' }, | ||
]; | ||
|
||
// test default | ||
it('Woofs in English by default', async () => { | ||
const { stdout, code, stderr } = await runSnykCLI(`woof`); | ||
|
||
expect(stdout).toContain('Woof!'); | ||
expect(code).toBe(0); | ||
expect(stderr).toBe(''); | ||
}); | ||
|
||
// test unsuported | ||
it('Woofs in English when passed unsupported language', async () => { | ||
const { stdout, stderr, code } = await runSnykCLI( | ||
`woof --language=blalbla`, | ||
); | ||
|
||
expect(stdout).toContain('Woof!'); | ||
expect(code).toBe(0); | ||
expect(stderr).toBe(''); | ||
}); | ||
|
||
it('Woofs in Czech when passed "cs"', async () => { | ||
const { stdout, code, stderr } = await runSnykCLI(`woof --language=cs`); | ||
|
||
expect(stdout).toContain('Haf!'); | ||
expect(code).toBe(0); | ||
expect(stderr).toBe(''); | ||
// test each supported language code | ||
languages.forEach(({ langCode, expectedWoof }) => { | ||
it(`Woofs in ${langCode}`, async () => { | ||
const { stdout, code, stderr } = await runSnykCLI( | ||
`woof --language=${langCode}`, | ||
); | ||
expect(stdout).toContain(expectedWoof); | ||
expect(code).toBe(0); | ||
expect(stderr).toBe(''); | ||
}); | ||
}); | ||
}); |