|
| 1 | +import { assert } from 'chai' |
| 2 | +import { describe, it } from 'mocha' |
| 3 | +import { shouldIgnoreException } from '../ignore' |
| 4 | + |
| 5 | +describe('ignoreExceptions', () => { |
| 6 | + it('should match exact', () => { |
| 7 | + assert.isTrue(shouldIgnoreException('BaseException', ['BaseException'])) |
| 8 | + }) |
| 9 | + it('should no match exact', () => { |
| 10 | + assert.isFalse(shouldIgnoreException('BaseException', ['SomeOtherException'])) |
| 11 | + }) |
| 12 | + it('should match wildcard end exact', () => { |
| 13 | + assert.isTrue(shouldIgnoreException('BaseException', ['BaseException*'])) |
| 14 | + }) |
| 15 | + it('should match wildcard end extra', () => { |
| 16 | + assert.isTrue(shouldIgnoreException('BaseExceptionMore', ['BaseException*'])) |
| 17 | + }) |
| 18 | + it('should match namespaced exact', () => { |
| 19 | + assert.isTrue(shouldIgnoreException('NS1\\BaseException', ['NS1\\BaseException'])) |
| 20 | + }) |
| 21 | + it('should match namespaced wildcard exact', () => { |
| 22 | + assert.isTrue(shouldIgnoreException('NS1\\BaseException', ['NS1\\BaseException*'])) |
| 23 | + }) |
| 24 | + it('should match namespaced wildcard extra', () => { |
| 25 | + assert.isTrue(shouldIgnoreException('NS1\\BaseExceptionMore', ['NS1\\BaseException*'])) |
| 26 | + }) |
| 27 | + it('should match namespaced wildcard whole level', () => { |
| 28 | + assert.isTrue(shouldIgnoreException('NS1\\BaseException', ['NS1\\*'])) |
| 29 | + }) |
| 30 | + it('should not match namespaced wildcard more levels', () => { |
| 31 | + assert.isFalse(shouldIgnoreException('NS1\\NS2\\BaseException', ['NS1\\*'])) |
| 32 | + }) |
| 33 | + it('should match namespaced wildcard in middle', () => { |
| 34 | + assert.isTrue(shouldIgnoreException('NS1\\NS2\\BaseException', ['NS1\\*\\BaseException'])) |
| 35 | + }) |
| 36 | + it('should match namespaced wildcard multiple', () => { |
| 37 | + assert.isTrue(shouldIgnoreException('NS1\\NS2\\NS3\\BaseException', ['NS1\\*\\*\\BaseException'])) |
| 38 | + }) |
| 39 | + it('should match namespaced wildcard levels', () => { |
| 40 | + assert.isTrue(shouldIgnoreException('NS1\\NS2\\NS3\\BaseException', ['NS1\\**\\BaseException'])) |
| 41 | + }) |
| 42 | +}) |
0 commit comments