1- import { checkWordOccurrence } from './CheckWordOccurrence' ;
1+ import { checkWordOccurrence } from './CheckWordOccurrence'
22describe ( 'checkWordOccurrence' , ( ) => {
33 it ( 'expects throw on insert wrong string' , ( ) => {
4- const value = 123 ;
5- expect ( ( ) => checkWordOccurrence ( value ) ) . toThrow ( ) ;
6- } ) ;
4+ const value = 123
5+ expect ( ( ) => checkWordOccurrence ( value ) ) . toThrow ( )
6+ } )
77 it ( 'expect throw on insert wrong param for case sensitive' , ( ) => {
8- const value = 'hello' ;
9- expect ( ( ) => checkWordOccurrence ( value , value ) ) . toThrow ( ) ;
10- } ) ;
8+ const value = 'hello'
9+ expect ( ( ) => checkWordOccurrence ( value , value ) ) . toThrow ( )
10+ } )
1111 it ( 'check occurrence with case sensitive' , ( ) => {
12- const stringToTest = " A Mad World" ;
13- const charsOccurrences = checkWordOccurrence ( stringToTest , true ) ;
14- const expectResult = { A : 1 , M : 1 , a : 1 , d : 2 , W : 1 , l : 1 , o : 1 , r : 1 } ;
15- const occurrencesObjectKeys = Object . keys ( charsOccurrences ) ;
16- const expectObjectKeys = Object . keys ( expectResult ) ;
17- expect ( occurrencesObjectKeys . length ) . toBe ( expectObjectKeys . length ) ;
12+ const stringToTest = ' A Mad World'
13+ const charsOccurrences = checkWordOccurrence ( stringToTest , true )
14+ const expectResult = { A : 1 , M : 1 , a : 1 , d : 2 , W : 1 , l : 1 , o : 1 , r : 1 }
15+ const occurrencesObjectKeys = Object . keys ( charsOccurrences )
16+ const expectObjectKeys = Object . keys ( expectResult )
17+ expect ( occurrencesObjectKeys . length ) . toBe ( expectObjectKeys . length )
1818 expectObjectKeys . forEach ( key => {
19- expect ( expectResult [ key ] ) . toBe ( charsOccurrences [ key ] ) ;
20- } ) ;
21- } ) ;
19+ expect ( expectResult [ key ] ) . toBe ( charsOccurrences [ key ] )
20+ } )
21+ } )
2222 it ( 'check occurrence with case insensitive' , ( ) => {
23- const stringToTest = " A Mad World" ;
24- const charsOccurrences = checkWordOccurrence ( stringToTest , false ) ;
25- const expectResult = { A : 2 , D : 2 , L : 1 , M : 1 , O : 1 , R : 1 , W : 1 } ;
26- const occurrencesObjectKeys = Object . keys ( charsOccurrences ) ;
27- const expectObjectKeys = Object . keys ( expectResult ) ;
28- expect ( occurrencesObjectKeys . length ) . toBe ( expectObjectKeys . length ) ;
23+ const stringToTest = ' A Mad World'
24+ const charsOccurrences = checkWordOccurrence ( stringToTest , false )
25+ const expectResult = { A : 2 , D : 2 , L : 1 , M : 1 , O : 1 , R : 1 , W : 1 }
26+ const occurrencesObjectKeys = Object . keys ( charsOccurrences )
27+ const expectObjectKeys = Object . keys ( expectResult )
28+ expect ( occurrencesObjectKeys . length ) . toBe ( expectObjectKeys . length )
2929 expectObjectKeys . forEach ( key => {
30- expect ( expectResult [ key ] ) . toBe ( charsOccurrences [ key ] ) ;
31- } ) ;
32-
33- } ) ;
34- } ) ;
30+ expect ( expectResult [ key ] ) . toBe ( charsOccurrences [ key ] )
31+ } )
32+ } )
33+ } )
0 commit comments