|
| 1 | +/* |
| 2 | +* @author: Chisimdi Damian Ezeanieto |
| 3 | +* @date: 11/03/2023 |
| 4 | +*/ |
| 5 | +const phoneKeyPadMatch = require('./index'); |
| 6 | + |
| 7 | +describe('Phone key pad match', () => { |
| 8 | + test('phoneKeyPadMatch function is defined', () => { |
| 9 | + expect(typeof phoneKeyPadMatch).toEqual('function'); |
| 10 | + }); |
| 11 | + test('Calculate correct phoneKeyPadMatch value for "23" === ["ad","ae","af","bd","be","bf","cd","ce","cf"]', () => { |
| 12 | + expect(phoneKeyPadMatch('23')).toEqual(["ad","ae","af","bd","be","bf","cd","ce","cf"]); |
| 13 | + }); |
| 14 | + test("Calculate correct phoneKeyPadMatch value for '234' === [ 'ad', 'ae', 'af', 'ag','ah', 'ai', 'bd', 'be','bf', 'bg', 'bh', 'bi','cd', 'ce', 'cf', 'cg','ch', 'ci']", () => { |
| 15 | + expect(phoneKeyPadMatch('234')).toEqual([ |
| 16 | + 'ad', 'ae', 'af', 'ag','ah', 'ai', 'bd', 'be','bf', 'bg', 'bh', 'bi','cd', 'ce', 'cf', 'cg','ch', 'ci' |
| 17 | + ]); |
| 18 | + }); |
| 19 | + test("Calculate correct phoneKeyPadMatch value for 'aaaa' & 'aa' === ['dg', 'dh', 'di', 'eg', 'eh', 'ei', 'fg', 'fh', 'fi']", () => { |
| 20 | + expect(phoneKeyPadMatch('34')).toEqual(['dg', 'dh', 'di', 'eg', 'eh', 'ei', 'fg', 'fh', 'fi']); |
| 21 | + }); |
| 22 | +}); |
0 commit comments