Skip to main content
Module

x/rambda/source/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 properties of null (reading 'match')` )})