This repository was archived by the owner on Mar 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +23
-5
lines changed
Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -134,13 +134,15 @@ const Cache = (strapi) => {
134134 }
135135 } ;
136136
137- router . post ( '/content-manager/explorer/:scope' , bustAdmin ) ;
138- router . put ( '/content-manager/explorer/:scope/:id*' , bustAdmin ) ;
139- router . delete ( '/content-manager/explorer/:scope/:id*' , bustAdmin ) ;
137+ router . post ( '/content-manager/explorer/:scope' , bustAdmin ) ;
138+ router . post ( '/content-manager/explorer/:scope/publish/:id*' , bustAdmin ) ;
139+ router . post ( '/content-manager/explorer/:scope/unpublish/:id*' , bustAdmin ) ;
140+ router . put ( '/content-manager/explorer/:scope/:id*' , bustAdmin ) ;
141+ router . delete ( '/content-manager/explorer/:scope/:id*' , bustAdmin ) ;
140142
141143 strapi . app . use ( router . routes ( ) ) ;
142144 } ,
143145 } ;
144146} ;
145147
146- module . exports = Cache ;
148+ module . exports = Cache ;
Original file line number Diff line number Diff line change 11{
22 "name" : " strapi-middleware-cache" ,
3- "version" : " 1.0.10 " ,
3+ "version" : " 1.0.11 " ,
44 "description" : " Cache strapi requests" ,
55 "main" : " ./lib" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -114,6 +114,22 @@ describe('Caching', () => {
114114 expect ( res3 . body . uid ) . to . equal ( res2 . body . uid + 1 ) ;
115115 expect ( requests ) . to . have . lengthOf ( 3 ) ;
116116 } ) ;
117+
118+ it ( `busts the cache on an admin panel ${ method . toUpperCase ( ) } publishing change` , async ( ) => {
119+ const res1 = await agent ( strapi . app ) . get ( '/academies' ) . expect ( 200 ) ;
120+
121+ expect ( requests ) . to . have . lengthOf ( 1 ) ;
122+
123+ const res2 = await agent ( strapi . app ) [ method ] ( '/content-manager/explorer/application::academy.academy/publish/1' ) . expect ( 200 ) ;
124+
125+ expect ( res2 . body . uid ) . to . equal ( res1 . body . uid + 1 ) ;
126+ expect ( requests ) . to . have . lengthOf ( 2 ) ;
127+
128+ const res3 = await agent ( strapi . app ) . get ( '/academies' ) . expect ( 200 ) ;
129+
130+ expect ( res3 . body . uid ) . to . equal ( res2 . body . uid + 1 ) ;
131+ expect ( requests ) . to . have . lengthOf ( 3 ) ;
132+ } ) ;
117133 } ) ;
118134 } ) ;
119135
You can’t perform that action at this time.
0 commit comments