Skip to content

Commit

Permalink
add tests for match (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
jelhan authored and sindresorhus committed Oct 22, 2016
1 parent 58e5f3e commit ca34f45
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var fixture = [
'foo 0.0.0 bar 0.0.0'
];

it('should match semver versions', function () {
it('should match semver versions on test', function () {
fixture.forEach(function (el) {
assert(semverRegex().test(el), el);
});
Expand All @@ -26,3 +26,13 @@ it('should match semver versions', function () {
assert(!semverRegex().test('1.08.0'));
assert(!semverRegex().test('01.8.0'));
});

it('should return semver on match', function () {
assert.deepEqual('0.0.0'.match(semverRegex()), ['0.0.0']);
assert.deepEqual('foo 0.0.0 bar 0.1.1'.match(semverRegex()), ['0.0.0', '0.1.1']);
});

// See: https://github.com/sindresorhus/semver-regex/issues/7
it.skip('should not return tag prefix', function () {
assert.deepEqual('v0.0.0'.match(semverRegex()), ['0.0.0'])
});

0 comments on commit ca34f45

Please sign in to comment.