@@ -118,46 +118,21 @@ describe( 'Store Reducer', () => {
118
118
) . not . toHaveProperty ( '_embedded' ) ;
119
119
} ) ;
120
120
121
- it ( 'should filter out location property' , ( ) => {
122
- const abilities = [
123
- {
124
- name : 'test/ability' ,
125
- label : 'Test Ability' ,
126
- description : 'Test ability with location' ,
127
- location : 'client' ,
128
- } ,
129
- ] ;
130
-
131
- const action = {
132
- type : RECEIVE_ABILITIES ,
133
- abilities,
134
- } ;
135
-
136
- const state = reducer (
137
- { abilitiesByName : defaultState } ,
138
- action
139
- ) ;
140
-
141
- expect (
142
- state . abilitiesByName [ 'test/ability' ]
143
- ) . not . toHaveProperty ( 'location' ) ;
144
- } ) ;
145
-
146
121
it ( 'should preserve all valid ability properties' , ( ) => {
147
122
const abilities = [
148
123
{
149
124
name : 'test/ability' ,
150
125
label : 'Test Ability' ,
151
- description : 'Full test ability' ,
126
+ description : 'Full test ability. ' ,
152
127
input_schema : { type : 'object' } ,
153
128
output_schema : { type : 'object' } ,
154
- meta : { type : 'resource' as const } ,
129
+ annotations : { read_only : true } ,
130
+ meta : { category : 'test' } ,
155
131
callback : ( ) => Promise . resolve ( { } ) ,
156
132
permissionCallback : ( ) => true ,
157
133
// Extra properties that should be filtered out
158
134
_links : { self : { href : '/test' } } ,
159
135
_embedded : { test : 'value' } ,
160
- location : 'client' ,
161
136
extra_field : 'should be removed' ,
162
137
} ,
163
138
] ;
@@ -176,17 +151,17 @@ describe( 'Store Reducer', () => {
176
151
// Should have valid properties
177
152
expect ( ability . name ) . toBe ( 'test/ability' ) ;
178
153
expect ( ability . label ) . toBe ( 'Test Ability' ) ;
179
- expect ( ability . description ) . toBe ( 'Full test ability' ) ;
154
+ expect ( ability . description ) . toBe ( 'Full test ability. ' ) ;
180
155
expect ( ability . input_schema ) . toEqual ( { type : 'object' } ) ;
181
156
expect ( ability . output_schema ) . toEqual ( { type : 'object' } ) ;
182
- expect ( ability . meta ) . toEqual ( { type : 'resource' } ) ;
157
+ expect ( ability . annotations ) . toEqual ( { read_only : true } ) ;
158
+ expect ( ability . meta ) . toEqual ( { category : 'test' } ) ;
183
159
expect ( ability . callback ) . toBeDefined ( ) ;
184
160
expect ( ability . permissionCallback ) . toBeDefined ( ) ;
185
161
186
162
// Should NOT have invalid properties
187
163
expect ( ability ) . not . toHaveProperty ( '_links' ) ;
188
164
expect ( ability ) . not . toHaveProperty ( '_embedded' ) ;
189
- expect ( ability ) . not . toHaveProperty ( 'location' ) ;
190
165
expect ( ability ) . not . toHaveProperty ( 'extra_field' ) ;
191
166
} ) ;
192
167
} ) ;
@@ -225,7 +200,6 @@ describe( 'Store Reducer', () => {
225
200
description : 'Test ability' ,
226
201
callback : ( ) => Promise . resolve ( { } ) ,
227
202
// Extra properties that should be filtered out
228
- location : 'client' ,
229
203
_links : { self : { href : '/test' } } ,
230
204
extra_field : 'should be removed' ,
231
205
} ;
@@ -249,7 +223,6 @@ describe( 'Store Reducer', () => {
249
223
expect ( registeredAbility . callback ) . toBeDefined ( ) ;
250
224
251
225
// Should NOT have invalid properties
252
- expect ( registeredAbility ) . not . toHaveProperty ( 'location' ) ;
253
226
expect ( registeredAbility ) . not . toHaveProperty ( '_links' ) ;
254
227
expect ( registeredAbility ) . not . toHaveProperty ( 'extra_field' ) ;
255
228
} ) ;
0 commit comments