@@ -22,8 +22,16 @@ describe('<CommentInput />', () => {
2222
2323 expect ( wrapper . find ( 'Styled(TextInput)' ) . length ) . toEqual ( 1 ) ;
2424 expect ( wrapper . find ( 'Styled(TouchableOpacity)' ) . length ) . toEqual ( 1 ) ;
25- expect ( wrapper . find ( 'Styled(PostButtonIcon)' ) . length ) . toEqual ( 1 ) ;
25+ } ) ;
26+
27+ it ( 'should not render styled Text and Icon if user has post permissions and issue is not locked' , ( ) => {
28+
29+ const wrapper = shallow (
30+ < CommentInput { ...defaultProps } />
31+ ) ;
32+
2633 expect ( wrapper . find ( 'Styled(Text)' ) . length ) . toEqual ( 0 ) ;
34+ expect ( wrapper . find ( 'Icon' ) . length ) . toEqual ( 0 ) ;
2735 } ) ;
2836
2937 it ( 'should not render styled TextInput and styled TouchableOpacity if user does not have post permissions and issue is locked' , ( ) => {
@@ -37,6 +45,17 @@ describe('<CommentInput />', () => {
3745
3846 expect ( wrapper . find ( 'Styled(TextInput)' ) . length ) . toEqual ( 0 ) ;
3947 expect ( wrapper . find ( 'Styled(TouchableOpacity)' ) . length ) . toEqual ( 0 ) ;
48+ } ) ;
49+
50+ it ( 'should render styled Text and Icon if user does not have post permissions and issue is locked' , ( ) => {
51+
52+ const wrapper = shallow (
53+ < CommentInput
54+ { ...defaultProps }
55+ userHasPushPermission = { false }
56+ issueLocked = { true } />
57+ ) ;
58+
4059 expect ( wrapper . find ( 'Styled(Text)' ) . length ) . toEqual ( 1 ) ;
4160 expect ( wrapper . find ( 'Icon' ) . length ) . toEqual ( 1 ) ;
4261 } ) ;
@@ -48,27 +67,41 @@ describe('<CommentInput />', () => {
4867 issueLocked = { true } />
4968 ) ;
5069
51- console . log ( wrapper . debug ( ) ) ;
52-
5370 expect ( wrapper . find ( 'Styled(TextInput)' ) . length ) . toEqual ( 1 ) ;
5471 expect ( wrapper . find ( 'Styled(TouchableOpacity)' ) . length ) . toEqual ( 1 ) ;
55- expect ( wrapper . find ( 'Styled(PostButtonIcon)' ) . length ) . toEqual ( 1 ) ;
56- expect ( wrapper . find ( 'Styled(Text)' ) . length ) . toEqual ( 0 ) ;
5772 } ) ;
5873
59- it ( 'should render styled TextInput and styled TouchableOpacity if user has not post permissions and issue is not locked' , ( ) => {
74+ it ( 'should not render styled Text and Icon if user has post permissions and issue is locked' , ( ) => {
6075 const wrapper = shallow (
6176 < CommentInput
6277 { ...defaultProps }
6378 issueLocked = { true } />
6479 ) ;
6580
66- console . log ( wrapper . debug ( ) ) ;
81+ expect ( wrapper . find ( 'Styled(Text)' ) . length ) . toEqual ( 0 ) ;
82+ expect ( wrapper . find ( 'Icon' ) . length ) . toEqual ( 0 ) ;
83+ } ) ;
84+
85+ it ( 'should render styled TextInput and styled TouchableOpacity if user does not have post permissions and issue is not locked' , ( ) => {
86+ const wrapper = shallow (
87+ < CommentInput
88+ { ...defaultProps }
89+ issueLocked = { true } />
90+ ) ;
6791
6892 expect ( wrapper . find ( 'Styled(TextInput)' ) . length ) . toEqual ( 1 ) ;
6993 expect ( wrapper . find ( 'Styled(TouchableOpacity)' ) . length ) . toEqual ( 1 ) ;
70- expect ( wrapper . find ( 'Styled(PostButtonIcon)' ) . length ) . toEqual ( 1 ) ;
94+ } ) ;
95+
96+ it ( 'should not render styled Text and icon if user does not have post permissions and issue is not locked' , ( ) => {
97+ const wrapper = shallow (
98+ < CommentInput
99+ { ...defaultProps }
100+ issueLocked = { true } />
101+ ) ;
102+
71103 expect ( wrapper . find ( 'Styled(Text)' ) . length ) . toEqual ( 0 ) ;
104+ expect ( wrapper . find ( 'Icon' ) . length ) . toEqual ( 0 ) ;
72105 } ) ;
73106
74107 it ( 'should update the state text if value is changed' , ( ) => {
0 commit comments