@@ -9,7 +9,62 @@ Enzyme.configure({ adapter: new Adapter() });
99
1010describe ( 'Description Component' , ( ) => {
1111 it ( 'should render with text prop and wihtout optional prop' , ( ) => {
12- const wrapper = shallow ( < ContentYear year = "hello" /> ) ;
13- expect ( wrapper . find ( '.item-year-component' ) . text ( ) ) . to . be . equal ( 'hello' ) ;
12+ const wrapper = shallow ( < ContentYear startYear = "2018" /> ) ;
13+ expect ( wrapper . find ( '.item-year-component' ) . text ( ) ) . to . be . equal ( '2018' ) ;
14+ } ) ;
15+
16+ it ( 'should render with startYear and currentYear' , ( ) => {
17+ const wrapper = shallow ( < ContentYear startYear = "2018" currentYear /> ) ;
18+ expect (
19+ wrapper
20+ . find ( '.item-year-component' )
21+ . at ( 0 )
22+ . text ( ) ,
23+ ) . to . be . equal ( '2020' ) ;
24+ expect (
25+ wrapper
26+ . find ( '.item-year-component' )
27+ . at ( 1 )
28+ . text ( ) ,
29+ ) . to . be . equal ( '2018' ) ;
30+ } ) ;
31+
32+ it ( 'should render with startMonth and default type' , ( ) => {
33+ const wrapper = shallow ( < ContentYear startYear = "2018" startMonth = "1" /> ) ;
34+ expect ( wrapper . find ( '.item-year-component' ) . text ( ) ) . to . be . equal ( '01-2018' ) ;
35+ } ) ;
36+
37+ it ( 'should render with startMonth and text type' , ( ) => {
38+ const wrapper = shallow (
39+ < ContentYear startYear = "2018" startMonth = "1" monthType = "text" /> ,
40+ ) ;
41+ expect ( wrapper . find ( '.item-year-component' ) . text ( ) ) . to . be . equal (
42+ 'Jan, 2018' ,
43+ ) ;
44+ } ) ;
45+
46+ it ( 'should render full date with nonth, day, year and default type' , ( ) => {
47+ const wrapper = shallow (
48+ < ContentYear startYear = "2018" startMonth = "1" startDay = "12" /> ,
49+ ) ;
50+
51+ expect ( wrapper . find ( '.item-year-component' ) . text ( ) ) . to . be . equal (
52+ '01-12-2018' ,
53+ ) ;
54+ } ) ;
55+
56+ it ( 'should render full date with nonth, day and year and text type' , ( ) => {
57+ const wrapper = shallow (
58+ < ContentYear
59+ startYear = "2018"
60+ startMonth = "1"
61+ startDay = "12"
62+ monthType = "text"
63+ /> ,
64+ ) ;
65+
66+ expect ( wrapper . find ( '.item-year-component' ) . text ( ) ) . to . be . equal (
67+ 'Jan 12, 2018' ,
68+ ) ;
1469 } ) ;
1570} ) ;
0 commit comments