Skip to main content
Module

x/rambda/match.spec.js

Faster and smaller alternative to Ramda
Go to Latest
File
import { equals } from './equals'import { match } from './match'
test('happy', () => { expect(match(/a./g)('foo bar baz')).toEqual([ 'ar', 'az' ])})
test('fallback', () => { expect(match(/a./g)('foo')).toEqual([])})
test('with string', () => { expect(match('a', 'foo')).toEqual([]) expect(equals(match('o', 'foo'), [ 'o' ])).toBeTrue()})
test('throwing', () => { expect(() => { match(/a./g, null) }).toThrowWithMessage(TypeError, 'Cannot read property \'match\' of null')})