GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — JavaScript/String/test/PatternMatching.test.js at master · Algorithms-Learn/JavaScript Expand file tree/ Copy pathPatternMatching.test.jsMore file actions 28 lines (28 loc) · 1.04 KB / Copy pathPatternMatching.test.jsFile metadata and controls28 lines (28 loc) · 1.04 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 import { checkIfPatternExists } from '../PatternMatching' describe('checkIfPatternExists', () => { it('expects to find a pattern with correct input', () => { const text = 'AABAACAADAABAAAABAA' const pattern = 'AABA' const SUT = checkIfPatternExists(text.toLowerCase(), pattern.toLowerCase()) expect(SUT).toBe('Given pattern is found at index 0') }) it('expects to return a message when there is no pattern', () => { const text = 'ABCDEFG' const pattern = 'AEG' const SUT = checkIfPatternExists(text.toLowerCase(), pattern.toLowerCase()) expect(SUT).toBe(undefined) }) it('expects to find a pattern independent of casing', () => { const text = 'AbCAAAAAAB' const pattern = 'abc' const SUT = checkIfPatternExists(text, pattern) expect(SUT).toBe(undefined) }) it('expects to throw an error message when given input is not a string', () => { const text = 123444456 const pattern = 123 expect(() => checkIfPatternExists(text, pattern)).toThrow( 'Given input is not a string' ) }) }) |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |