Skip to content

Instantly share code, notes, and snippets.

@NickHeiner
Last active August 29, 2015 14:18
Show Gist options
  • Save NickHeiner/21048fc2f90c9568bbb4 to your computer and use it in GitHub Desktop.
Save NickHeiner/21048fc2f90c9568bbb4 to your computer and use it in GitHub Desktop.
// app code file
// app/utils/get-greeting.js
const constants = require('../constants');
module.exports = function getGreeting(name) {
return CONSTANTS.GREETING_PREFIX + name;
}
// test code file snippet
// test/utils/get-greeting.test.js
const constants = require('../../app/constants');
expect(getGreeting('Sam')).to.equal(CONSTANTS.GREETING_PREFIX + 'Sam');
// constants file
// app/constants.js
module.exports = {GREETING_PREFIX: 'Hi, '};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment