File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -190,8 +190,45 @@ describe('Entry api Test', () => {
190190 } )
191191 . catch ( done )
192192 } )
193+
194+ it ( 'Create and update an entry with asset' , done => {
195+ // get asset
196+ let asset ;
197+ makeAsset ( )
198+ . query ( )
199+ . find ( )
200+ . then ( ( collection ) => {
201+ asset = collection . items [ 0 ] ;
202+ // create entry
203+ let entry = {
204+ ...entryFirst ,
205+ title : "uniqueTitle45" ,
206+ modular_blocks : [
207+ {
208+ block1 : {
209+ file : asset . uid
210+ }
211+ }
212+ ]
213+ } ;
214+ makeEntry ( multiPageCT . content_type . uid )
215+ . create ( { entry : entry } )
216+ . then ( entry => {
217+ const newTitle = "updated title" ;
218+ entry . title = newTitle ;
219+ entry . update ( ) . then ( updatedEntry => {
220+ expect ( updatedEntry . title ) . to . be . equal ( newTitle ) ;
221+ done ( ) ;
222+ } )
223+ } )
224+ } )
225+ } ) ;
193226} )
194227
195228function makeEntry ( contentType , uid = null ) {
196229 return client . stack ( { api_key : stack . api_key } ) . contentType ( contentType ) . entry ( uid )
197230}
231+
232+ function makeAsset ( uid = null ) {
233+ return client . stack ( { api_key : stack . api_key } ) . asset ( uid )
234+ }
You can’t perform that action at this time.
0 commit comments