Open
Conversation
broxsonl
reviewed
Feb 16, 2017
| module.exports = exports = {}; | ||
|
|
||
| exports.greet = function greet(name) { | ||
| return `hello ${name}`; |
| return `hello ${name}`; | ||
| } | ||
|
|
||
| if(process.argv[2]) console.log(exports.greet(process.argv[2])); |
There was a problem hiding this comment.
You might consider storing the value of process.argv[2] into a variable for user elsewhere. Saves on typing the complex line of code, and also makes it a bit more human readable.
| describe('#greet', function() { | ||
| it('should return hello remi', function() { | ||
| var arg = greet.greet('remi'); | ||
| assert.ok(arg === 'hello remi', 'not equal to hello remi'); |
| const assert = require('assert'); | ||
|
|
||
| describe('Greet Module Test', function(){ | ||
| describe('#greet', function() { |
There was a problem hiding this comment.
Nice job using # before the method name when you're testing it.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[x] This assignment will have you create a simple Javascript object that will be exported using the NodeJS modular pattern we went over in class.
[x] Your object should have a function named 'greet' that takes a name as a parameter and returns the string 'hello ' + name.
[x] You should have at least one test that verifies the output of the function.
[x]Your submission should be a link to your pull request.
[x] Bonus: For an extra point, create a command line utility that will be run using node greet.js 'some name' and will pass the input contained in that argument to the greet function and output the result to the screen.