Skip to content

Instantly share code, notes, and snippets.

@MylesBorins
Created February 29, 2016 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MylesBorins/7906972dac06b3717ab8 to your computer and use it in GitHub Desktop.
Save MylesBorins/7906972dac06b3717ab8 to your computer and use it in GitHub Desktop.
'use strict';
var test = require('tap').test;
var rewire = require('rewire');
var npmTest = rewire('../lib/npm/test');
var authorName = npmTest.__get__('authorName');
test('npm.test() authorName:', function (t) {
var name = 'titus';
var author = {
name: 'Randy Savage',
email: 'randy@wwe.rekt',
url: 'omg.html'
};
var authorExpected = 'Randy Savage <randy@wwe.rekt> (omg.html)';
t.equals(authorName(name), name, 'it should return any string');
t.equals(authorName(author), authorExpected, 'it should return the expected string when given an object')
t.end();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment