Back to home page

EIC code displayed by LXR

 
 

    


Warning, /firebird/firebird-ng/src/app/utils/wildcard.spec.ts is written in an unsupported language. File is not indexed.

0001 import { wildCardCheck } from './wildcard';
0002 
0003 describe('wildCardCheck', () => {
0004   it('should match exactly without wildcards', () => {
0005     expect(wildCardCheck('hello', 'hello')).toBeTruthy();
0006   });
0007 
0008   it('should return false when patterns do not match', () => {
0009     expect(wildCardCheck('world', 'hello')).toBeFalsy();
0010   });
0011 
0012   it('should match a single character wildcard ?', () => {
0013     expect(wildCardCheck('hello', 'h?llo')).toBeTruthy();
0014     expect(wildCardCheck('hallo', 'h?llo')).toBeTruthy();
0015   });
0016 
0017   it('should match any sequence with *', () => {
0018     expect(wildCardCheck('hello', 'he*o')).toBeTruthy();
0019     expect(wildCardCheck('heooo', 'he*o')).toBeTruthy();
0020   });
0021 
0022   it('should match with multiple wildcards', () => {
0023     expect(wildCardCheck('hello', '*o')).toBeTruthy();
0024     expect(wildCardCheck('ho', 'h*o')).toBeTruthy();
0025     expect(wildCardCheck('abcde', 'a*c*e')).toBeTruthy();
0026   });
0027 
0028   it('should match with wildcards at both ends', () => {
0029     expect(wildCardCheck('xxhelloxx', '*hello*')).toBeTruthy();
0030   });
0031 
0032   it('should handle empty strings and wildcards correctly', () => {
0033     expect(wildCardCheck('', '*')).toBeTruthy();
0034     expect(wildCardCheck('', 'a*')).toBeFalsy();
0035     expect(wildCardCheck('', '')).toBeTruthy();
0036     expect(wildCardCheck('a', '')).toBeFalsy();
0037   });
0038 
0039   it('should match with complex patterns', () => {
0040     expect(wildCardCheck('axxbxxcxxdxe', 'a?*b*c*d*e*')).toBeTruthy();
0041   });
0042 });