Files
JavaScript/Recursive/test/LetterCombination.test.js
2022-10-21 16:54:37 +05:30

49 lines
994 B
JavaScript

import { letterCombinations } from '../LetterCombination'
describe('Letter Combinations', () => {
it('should return empty array if provided string is not valid', () => {
const result = letterCombinations('')
expect(Array.isArray(result)).toBe(true)
expect(result.length).toBe(0)
})
it('should return empty array if provided string is empty', () => {
const result = letterCombinations(null)
expect(Array.isArray(result)).toBe(true)
expect(result.length).toBe(0)
})
it('should return letter combination of 234', () => {
const result = letterCombinations('234')
expect(result).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'
])
})
})