mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 16:26:47 +08:00
Add max word algorithm
This commit is contained in:
12
String/test/MaxWord.test.js
Normal file
12
String/test/MaxWord.test.js
Normal file
@ -0,0 +1,12 @@
|
||||
import { maxWord } from '../MaxWord'
|
||||
|
||||
describe('Testing the maxWord function', () => {
|
||||
it('Expect throw with non string argument', () => {
|
||||
expect(() => maxWord(10)).toThrow()
|
||||
})
|
||||
it('get the max word', () => {
|
||||
const string = 'ba ba ba ba banana'
|
||||
const mostOccuringWord = maxWord(string)
|
||||
expect(mostOccuringWord).toBe('ba')
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user