@@ -49,6 +49,87 @@ describe('SchemaRow component', () => {
4949    } ) ; 
5050  } ) ; 
5151
52+   describe ( 'resolving permission error' ,  ( )  =>  { 
53+     let  tree : RootNode ; 
54+     let  schema : JSONSchema4 ; 
55+ 
56+     it ( 'given an object schema is marked as internal, a permission denied error messsage should be shown' ,  ( )  =>  { 
57+       schema  =  { 
58+         type : 'object' , 
59+         'x-sl-internally-excluded' : true , 
60+         'x-sl-error-message' : 'You do not have permission to view this reference' , 
61+       } ; 
62+       tree  =  buildTree ( schema ) ; 
63+       const  wrapper  =  mount ( < SchemaRow  schemaNode = { tree . children [ 0 ] ! }  nestingLevel = { 0 }  /> ) ; 
64+       expect ( wrapper . find ( Icon ) . at ( 0 ) ) . toHaveProp ( 'title' ,  `You do not have permission to view this reference` ) ; 
65+       wrapper . unmount ( ) ; 
66+     } ) ; 
67+ 
68+     it ( 'given a number schema is marked as internal, a permission denied error messsage should be shown' ,  ( )  =>  { 
69+       schema  =  { 
70+         type : 'number' , 
71+         'x-sl-internally-excluded' : true , 
72+         'x-sl-error-message' : 'You do not have permission to view this reference' , 
73+       } ; 
74+       tree  =  buildTree ( schema ) ; 
75+       const  wrapper  =  mount ( < SchemaRow  schemaNode = { tree . children [ 0 ] ! }  nestingLevel = { 0 }  /> ) ; 
76+       expect ( wrapper . find ( Icon ) . at ( 0 ) ) . toHaveProp ( 'title' ,  `You do not have permission to view this reference` ) ; 
77+       wrapper . unmount ( ) ; 
78+     } ) ; 
79+ 
80+     it ( 'given an integer schema is marked as internal, a permission denied error messsage should be shown' ,  ( )  =>  { 
81+       schema  =  { 
82+         type : 'integer' , 
83+         'x-sl-internally-excluded' : true , 
84+         'x-sl-error-message' : 'You do not have permission to view this reference' , 
85+       } ; 
86+       tree  =  buildTree ( schema ) ; 
87+       const  wrapper  =  mount ( < SchemaRow  schemaNode = { tree . children [ 0 ] ! }  nestingLevel = { 0 }  /> ) ; 
88+       expect ( wrapper . find ( Icon ) . at ( 0 ) ) . toHaveProp ( 'title' ,  `You do not have permission to view this reference` ) ; 
89+       wrapper . unmount ( ) ; 
90+     } ) ; 
91+ 
92+     it ( 'given a string schema is marked as internal, a permission denied error messsage should be shown' ,  ( )  =>  { 
93+       schema  =  { 
94+         type : 'string' , 
95+         'x-sl-internally-excluded' : true , 
96+         'x-sl-error-message' : 'You do not have permission to view this reference' , 
97+       } ; 
98+       tree  =  buildTree ( schema ) ; 
99+       const  wrapper  =  mount ( < SchemaRow  schemaNode = { tree . children [ 0 ] ! }  nestingLevel = { 0 }  /> ) ; 
100+       expect ( wrapper . find ( Icon ) . at ( 0 ) ) . toHaveProp ( 'title' ,  `You do not have permission to view this reference` ) ; 
101+       wrapper . unmount ( ) ; 
102+     } ) ; 
103+ 
104+     it ( 'given a boolean schema is marked as internal, a permission denied error messsage should be shown' ,  ( )  =>  { 
105+       schema  =  { 
106+         type : 'boolean' , 
107+         'x-sl-internally-excluded' : true , 
108+         'x-sl-error-message' : 'You do not have permission to view this reference' , 
109+       } ; 
110+       tree  =  buildTree ( schema ) ; 
111+       const  wrapper  =  mount ( < SchemaRow  schemaNode = { tree . children [ 0 ] ! }  nestingLevel = { 0 }  /> ) ; 
112+       expect ( wrapper . find ( Icon ) . at ( 0 ) ) . toHaveProp ( 'title' ,  `You do not have permission to view this reference` ) ; 
113+       wrapper . unmount ( ) ; 
114+     } ) ; 
115+ 
116+     it ( 'given an array schema is marked as internal, a permission denied error messsage should be shown' ,  ( )  =>  { 
117+       schema  =  { 
118+         title : 'test' , 
119+         type : 'array' , 
120+         items : { 
121+           type : 'array' , 
122+           'x-sl-internally-excluded' : true , 
123+           'x-sl-error-message' : 'You do not have permission to view this reference' , 
124+         } , 
125+       } ; 
126+       tree  =  buildTree ( schema ) ; 
127+       const  wrapper  =  mount ( < SchemaRow  schemaNode = { tree . children [ 0 ] ! }  nestingLevel = { 0 }  /> ) ; 
128+       expect ( wrapper . find ( Icon ) . at ( 0 ) ) . toHaveProp ( 'title' ,  `You do not have permission to view this reference` ) ; 
129+       wrapper . unmount ( ) ; 
130+     } ) ; 
131+   } ) ; 
132+ 
52133  describe ( 'required property' ,  ( )  =>  { 
53134    let  schema : JSONSchema4 ; 
54135
0 commit comments