-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.js
63 lines (49 loc) · 1.93 KB
/
test.js
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* author-regex <https://github.com/assemble/author-regex>
*
* Copyright (c) 2014 Jon Schlinkert, contributors.
* Licensed under the MIT license.
*/
'use strict';
var assert = require('assert');
var should = require('should');
var re = require('./');
function author(str) {
return re().exec(str);
}
describe('author regex:', function () {
it('should return a parsed author object.', function () {
var fixture = 'Jon Schlinkert <jon.schlinkert@sellside.com> (https://github.com/jonschlinkert)';
var actual = author(fixture);
actual[1].should.equal('Jon Schlinkert');
actual[2].should.equal('jon.schlinkert@sellside.com');
actual[3].should.equal('https://github.com/jonschlinkert');
});
it('should return name and url.', function () {
var fixture = 'Jon Schlinkert (https://github.com/jonschlinkert)';
var actual = author(fixture);
actual[1].should.equal('Jon Schlinkert');
assert.equal(typeof actual[2], 'undefined');
actual[3].should.equal('https://github.com/jonschlinkert');
});
it('should return name and url.', function () {
var fixture = 'Jon Schlinkert(https://github.com/jonschlinkert)';
var actual = author(fixture);
actual[1].should.equal('Jon Schlinkert');
assert.equal(typeof actual[2], 'undefined');
actual[3].should.equal('https://github.com/jonschlinkert');
});
it('should email and url.', function () {
var fixture = '<jon.schlinkert@sellside.com> (https://github.com/jonschlinkert)';
var actual = author(fixture);
assert.equal(typeof actual[1], 'undefined');
actual[2].should.equal('jon.schlinkert@sellside.com');
actual[3].should.equal('https://github.com/jonschlinkert');
});
it('should return name and email.', function () {
var fixture = 'Jon Schlinkert <jon.schlinkert@sellside.com>';
var actual = author(fixture);
actual[1].should.equal('Jon Schlinkert');
actual[2].should.equal('jon.schlinkert@sellside.com');
});
});