Skip to content

Commit 4144188

Browse files
committed
Add basic global tests
1 parent 069abcc commit 4144188

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

test/test.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,23 @@ describe('phone-regex', function() {
2929
assert.equal(phone({ exact: true }).test('1 123 456 7890'), true);
3030
});
3131

32-
it('should not find a phone number if it is not exact', function(){
32+
it('should not find a phone number if it is not exact', function() {
3333
assert.equal(phone({ exact: true }).test('apples 1 123 456 7890'), false);
3434
});
3535
});
36+
37+
describe('g', function() {
38+
39+
it('should find a phone number when it exists', function() {
40+
assert.equal(phone().test('apples 1 123 456 7890'), true);
41+
});
42+
43+
it('should find all phone numbers in a string', function() {
44+
assert.equal('1 123 456 7890 orange (123) 456-7890'.match(phone()).length, 2);
45+
});
46+
47+
it('should not find phone numbers when they do not exist', function() {
48+
assert.equal('pineapples'.match(phone()), null);
49+
});
50+
});
3651
});

0 commit comments

Comments
 (0)