-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): add quotes around string to command
- Loading branch information
Showing
2 changed files
with
42 additions
and
5 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,25 @@ | ||
import { commandsObject } from '../src/command-line/nx-commands'; | ||
import { initLocal } from './init-local'; | ||
|
||
describe('initLocal', () => { | ||
it('should call commandsObject.parse with args wrapped in quotes if value contains space', () => { | ||
const spy = jest.spyOn(commandsObject, 'parse'); | ||
process.argv = ['nx', 'g', 'app', '--name=my app']; | ||
initLocal({ type: 'nx', dir: 'root' }); | ||
expect(spy).toHaveBeenCalledWith(['app', '--name="my app"']); | ||
}); | ||
|
||
it('should call commandsObject.parse with args wrapped in quotes if it is a string with space', () => { | ||
const spy = jest.spyOn(commandsObject, 'parse'); | ||
process.argv = ['nx', 'g', 'app', 'random string']; | ||
initLocal({ type: 'nx', dir: 'root' }); | ||
expect(spy).toHaveBeenCalledWith(['app', '"random string"']); | ||
}); | ||
|
||
it('should call commandsObject.parse with args not wrapped in quotes if it is one word', () => { | ||
const spy = jest.spyOn(commandsObject, 'parse'); | ||
process.argv = ['nx', 'g', 'app', '--name=app']; | ||
initLocal({ type: 'nx', dir: 'root' }); | ||
expect(spy).toHaveBeenCalledWith(['app', '--name=app']); | ||
}); | ||
}); |
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