@@ -2,45 +2,53 @@ import {expect} from 'chai';
2
2
import day2 from '../src/day2' ;
3
3
4
4
describe ( 'day2 tests' , ( ) => {
5
- it ( 'should return undefined when no parameters are passed' , ( ) => {
6
- expect ( day2 ( ) ) . to . be . undefined ;
7
- } ) ;
5
+ describe ( 'check data type' , ( ) => {
6
+ it ( 'should return undefined when no parameters are passed' , ( ) => {
7
+ expect ( day2 ( ) ) . to . be . undefined ;
8
+ } ) ;
8
9
9
- it ( 'should return a string when a string is passed' , ( ) => {
10
- expect ( day2 ( 'a string' ) ) . to . be . a ( 'string' ) ;
11
- } ) ;
10
+ it ( 'should return a string when a string is passed' , ( ) => {
11
+ expect ( day2 ( 'a string' ) ) . to . be . a ( 'string' ) ;
12
+ } ) ;
12
13
13
- it ( 'should return a number when a number is passed' , ( ) => {
14
- expect ( day2 ( 10 ) ) . to . be . a ( 'Number' ) ;
15
- } ) ;
14
+ it ( 'should return a number when a number is passed' , ( ) => {
15
+ expect ( day2 ( 10 ) ) . to . be . a ( 'Number' ) ;
16
+ } ) ;
16
17
17
- it ( 'should not be a string when a number is passed' , ( ) => {
18
- expect ( day2 ( 10 ) ) . to . not . be . a ( 'string' ) ;
18
+ it ( 'should not be a string when a number is passed' , ( ) => {
19
+ expect ( day2 ( 10 ) ) . to . not . be . a ( 'string' ) ;
20
+ } ) ;
19
21
} ) ;
20
22
21
- it ( 'should equal the string passed' , ( ) => {
22
- expect ( day2 ( 'same string' ) ) . to . equal ( 'same string' ) ;
23
- } ) ;
23
+ describe ( 'checking equals' , ( ) => {
24
+ it ( 'should equal the string passed' , ( ) => {
25
+ expect ( day2 ( 'same string' ) ) . to . equal ( 'same string' ) ;
26
+ } ) ;
24
27
25
- it ( 'should deep equal the object passed' , ( ) => {
26
- const givenObject = {
27
- hello : 'world'
28
- } ;
28
+ it ( 'should deep equal the object passed' , ( ) => {
29
+ const givenObject = {
30
+ hello : 'world'
31
+ } ;
29
32
30
- expect ( day2 ( givenObject ) ) . to . deep . equal ( givenObject ) ;
33
+ expect ( day2 ( givenObject ) ) . to . deep . equal ( givenObject ) ;
34
+ } ) ;
31
35
} ) ;
32
36
33
- it ( 'should contain part of the string passed' , ( ) => {
34
- const givenString = 'hello world' ;
37
+ describe ( 'checking contains' , ( ) => {
38
+ it ( 'should contain part of the string passed' , ( ) => {
39
+ const givenString = 'hello world' ;
35
40
36
- expect ( day2 ( givenString ) ) . to . contain ( 'world' ) ;
41
+ expect ( day2 ( givenString ) ) . to . contain ( 'world' ) ;
42
+ } ) ;
37
43
} ) ;
38
44
39
- it ( 'should throw an error when "error" is passed' , ( ) => {
40
- function wrappedFunction ( ) {
41
- day2 ( 'error' ) ;
42
- }
45
+ describe ( 'checking errors' , ( ) => {
46
+ it ( 'should throw an error when "error" is passed' , ( ) => {
47
+ function wrappedFunction ( ) {
48
+ day2 ( 'error' ) ;
49
+ }
43
50
44
- expect ( wrappedFunction ) . to . throw ( 'Cannot pass error' ) ;
51
+ expect ( wrappedFunction ) . to . throw ( 'Cannot pass error' ) ;
52
+ } ) ;
45
53
} ) ;
46
54
} ) ;
0 commit comments