1
1
const repeatString = require ( './repeatString' )
2
2
3
3
describe ( 'repeatString' , function ( ) {
4
+ //Test 1
4
5
it ( 'repeats the string' , function ( ) {
5
6
expect ( repeatString ( 'hey' , 3 ) ) . toEqual ( 'heyheyhey' ) ;
6
7
} ) ;
7
- xit ( 'repeats the string many times' , function ( ) {
8
+
9
+ //Test 2
10
+ it ( 'repeats the string many times' , function ( ) {
8
11
expect ( repeatString ( 'hey' , 10 ) ) . toEqual ( 'heyheyheyheyheyheyheyheyheyhey' ) ;
9
12
} ) ;
10
- xit ( 'repeats the string 1 times' , function ( ) {
13
+
14
+ //Test 3
15
+ it ( 'repeats the string 1 times' , function ( ) {
11
16
expect ( repeatString ( 'hey' , 1 ) ) . toEqual ( 'hey' ) ;
12
17
} ) ;
13
- xit ( 'repeats the string 0 times' , function ( ) {
18
+
19
+ //Test 4
20
+ it ( 'repeats the string 0 times' , function ( ) {
14
21
expect ( repeatString ( 'hey' , 0 ) ) . toEqual ( '' ) ;
15
22
} ) ;
16
- xit ( 'returns ERROR with negative numbers' , function ( ) {
23
+
24
+ //Test 5
25
+ it ( 'returns ERROR with negative numbers' , function ( ) {
17
26
expect ( repeatString ( 'hey' , - 1 ) ) . toEqual ( 'ERROR' ) ;
18
27
} ) ;
19
- xit ( 'repeats the string a random amount of times' , function ( ) {
28
+
29
+ //Test 6
30
+ it ( 'repeats the string a random amount of times' , function ( ) {
20
31
/*The number is generated by using Math.random to get a value from between
21
32
0 to 1, when this is multiplied by 1000 and rounded down with Math.floor it
22
33
equals a number between 0 to 999 (this number will change everytime you run
@@ -27,7 +38,9 @@ describe('repeatString', function() {
27
38
was randomaly generated. */
28
39
expect ( repeatString ( 'hey' , number ) . match ( / ( ( h e y ) ) / g) . length ) . toEqual ( number ) ;
29
40
} ) ;
30
- xit ( 'works with blank strings' , function ( ) {
41
+
42
+ //Test 7
43
+ it ( 'works with blank strings' , function ( ) {
31
44
expect ( repeatString ( '' , 10 ) ) . toEqual ( '' ) ;
32
45
} ) ;
33
46
} ) ;
0 commit comments