|
| 1 | +/* |
| 2 | +* @author: Chisimdi Damian Ezeanieto |
| 3 | +* @date: 11/03/2023 |
| 4 | +*/ |
| 5 | +const generateCombinations = require('./index'); |
| 6 | + |
| 7 | +describe('Phone key pad match', () => { |
| 8 | + test('generateCombinations function is defined', () => { |
| 9 | + expect(typeof generateCombinations).toEqual('function'); |
| 10 | + }); |
| 11 | + test('Calculate correct generateCombinations value for "23" === ["ad","ae","af","bd","be","bf","cd","ce","cf"]', () => { |
| 12 | + expect(generateCombinations('23')).toEqual(["ad","ae","af","bd","be","bf","cd","ce","cf"]); |
| 13 | + }); |
| 14 | + test("Calculate correct generateCombinations value for '234' === ['adg', 'adh', 'adi', 'aeg', 'aeh', 'aei', 'afg', 'afh', 'afi', 'bdg', 'bdh', 'bdi', 'beg', 'beh', 'bei', 'bfg', 'bfh', 'bfi', 'cdg', 'cdh', 'cdi', 'ceg', 'ceh', 'cei', 'cfg', 'cfh', 'cfi']", () => { |
| 15 | + expect(generateCombinations('234')).toEqual(['adg', 'adh', 'adi', 'aeg', 'aeh', 'aei', 'afg', 'afh', 'afi', 'bdg', 'bdh', 'bdi', 'beg', 'beh', 'bei', 'bfg', 'bfh', 'bfi', 'cdg', 'cdh', 'cdi', 'ceg', 'ceh', 'cei', 'cfg', 'cfh', 'cfi']); |
| 16 | + }); |
| 17 | + test("Calculate correct generateCombinations value for 'aaaa' & 'aa' === ['dg', 'dh', 'di', 'eg', 'eh', 'ei', 'fg', 'fh', 'fi']", () => { |
| 18 | + expect(generateCombinations('34')).toEqual(['dg', 'dh', 'di', 'eg', 'eh', 'ei', 'fg', 'fh', 'fi']); |
| 19 | + }); |
| 20 | +}); |
0 commit comments