Files
pnpm/packages/matcher/test/index.ts
Jason Staten 5a8fe0a1b4 test: convert four packages to use Jest
* chore: manifest-utils to jest

* chore: matcher to jest

* chore: modules-yaml to jest

* chore: npm-registry-agent to jest

Replaced `proxyquire` with jest mocking

Fixed `OPTS.strictSSL` fixture to be a boolean as that's what the
agent's option type expects.

`npm-registry-agent` self-links as a devDependency for importing

PR #2913
ref #2858
2020-10-07 11:34:07 +03:00

34 lines
811 B
TypeScript

import matcher from '@pnpm/matcher'
test('matcher()', () => {
{
const match = matcher('*')
expect(match('@eslint/plugin-foo')).toBe(true)
expect(match('express')).toBe(true)
}
{
const match = matcher(['eslint-*'])
expect(match('eslint-plugin-foo')).toBe(true)
expect(match('express')).toBe(false)
}
{
const match = matcher(['*plugin*'])
expect(match('@eslint/plugin-foo')).toBe(true)
expect(match('express')).toBe(false)
}
{
const match = matcher(['a*c'])
expect(match('abc')).toBe(true)
}
{
const match = matcher(['*-positive'])
expect(match('is-positive')).toBe(true)
}
{
const match = matcher(['foo', 'bar'])
expect(match('foo')).toBe(true)
expect(match('bar')).toBe(true)
expect(match('express')).toBe(false)
}
})