-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest.js
More file actions
35 lines (29 loc) · 975 Bytes
/
Copy pathtest.js
File metadata and controls
35 lines (29 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*!
* git-username <https://github.com/jonschlinkert/git-username>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
require('mocha');
var assert = require('assert');
var username = require('./');
describe('username', function() {
it('should return the username from a git remote origin url', function() {
assert.equal(username(), 'jonschlinkert');
assert.equal(username('.git'), 'jonschlinkert');
assert.equal(username('.git/config'), 'jonschlinkert');
});
it('should return null when not found', function() {
assert.equal(username('foo'), null);
assert.equal(username('bar/baz'), null);
});
it('should return throw an error when not found and options.strict is true', function() {
assert.throws(function() {
username('foo', { strict: true });
}, /cannot resolve/);
assert.throws(function() {
username('bar/baz', { strict: true });
}, /cannot resolve/);
});
});