Skip to content

Commit

Permalink
test: add test with Regex object
Browse files Browse the repository at this point in the history
  • Loading branch information
lekterable committed May 4, 2020
1 parent bdf771c commit c239131
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,26 @@ const isRegexy = require('../')

describe('isRegexy', () => {
it('should validate Regex object', () => {
expect(isRegexy(/development/)).toBe(true)
expect(isRegexy(new RegExp('development'))).toBe(true)
})

it('should validate Regex object with flag', () => {
expect(isRegexy(/development/i)).toBe(true)
expect(isRegexy(new RegExp('development', 'i'))).toBe(true)
})

it('should validate Regex object with multiple flags', () => {
expect(isRegexy(new RegExp('development', 'gi'))).toBe(true)
})

it('should validate Regex pattern', () => {
expect(isRegexy(/development/)).toBe(true)
})

it('should validate Regex pattern with flag', () => {
expect(isRegexy(/development/i)).toBe(true)
})

it('should validate Regex pattern with multiple flags', () => {
expect(isRegexy(/development/gi)).toBe(true)
})

Expand Down

0 comments on commit c239131

Please sign in to comment.