Skip to content

Commit ca34f45

Browse files
jelhansindresorhus
authored andcommitted
add tests for match (#8)
1 parent 58e5f3e commit ca34f45

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var fixture = [
1616
'foo 0.0.0 bar 0.0.0'
1717
];
1818

19-
it('should match semver versions', function () {
19+
it('should match semver versions on test', function () {
2020
fixture.forEach(function (el) {
2121
assert(semverRegex().test(el), el);
2222
});
@@ -26,3 +26,13 @@ it('should match semver versions', function () {
2626
assert(!semverRegex().test('1.08.0'));
2727
assert(!semverRegex().test('01.8.0'));
2828
});
29+
30+
it('should return semver on match', function () {
31+
assert.deepEqual('0.0.0'.match(semverRegex()), ['0.0.0']);
32+
assert.deepEqual('foo 0.0.0 bar 0.1.1'.match(semverRegex()), ['0.0.0', '0.1.1']);
33+
});
34+
35+
// See: https://github.com/sindresorhus/semver-regex/issues/7
36+
it.skip('should not return tag prefix', function () {
37+
assert.deepEqual('v0.0.0'.match(semverRegex()), ['0.0.0'])
38+
});

0 commit comments

Comments
 (0)