@@ -57,34 +57,43 @@ const makeApi = (calls: string[]): ApiService => ({
5757 if ( path === '/publish-jobs' ) return { id : 'task-1' } as never
5858 if ( path . startsWith ( '/notes/' ) ) {
5959 return {
60- id : '123456789012346' ,
61- title : 'Note' ,
62- slug : 'note' ,
63- contentFormat : 'markdown' ,
64- content : 'note body' ,
65- isPublished : false ,
66- mood : 'calm' ,
67- weather : 'clear' ,
60+ data : {
61+ id : '123456789012346' ,
62+ title : 'Note' ,
63+ slug : 'note' ,
64+ content_format : 'markdown' ,
65+ content : 'note body' ,
66+ is_published : false ,
67+ mood : 'calm' ,
68+ weather : 'clear' ,
69+ } ,
70+ meta : { } ,
6871 } as never
6972 }
7073 if ( path . startsWith ( '/pages/' ) ) {
7174 return {
72- id : '123456789012347' ,
73- title : 'Page' ,
74- slug : 'page' ,
75- contentFormat : 'markdown' ,
76- content : 'page body' ,
75+ data : {
76+ id : '123456789012347' ,
77+ title : 'Page' ,
78+ slug : 'page' ,
79+ content_format : 'markdown' ,
80+ content : 'page body' ,
81+ } ,
82+ meta : { } ,
7783 } as never
7884 }
7985 return {
80- id : '123456789012345' ,
81- title : 'Post' ,
82- slug : 'post' ,
83- contentFormat : 'markdown' ,
84- content : 'post body' ,
85- summary : 'summary' ,
86- isPublished : true ,
87- tags : [ 'a' , 'b' ] ,
86+ data : {
87+ id : '123456789012345' ,
88+ title : 'Post' ,
89+ slug : 'post' ,
90+ content_format : 'markdown' ,
91+ content : 'post body' ,
92+ summary : 'summary' ,
93+ is_published : true ,
94+ tags : [ 'a' , 'b' ] ,
95+ } ,
96+ meta : { } ,
8897 } as never
8998 } ) ,
9099 raw : ( path ) =>
@@ -190,7 +199,16 @@ describe('edit command no-change round trip', () => {
190199 const exit = await Effect . runPromiseExit (
191200 editPost
192201 . handler ( { slugOrId : 'post' , ...commonPostOptions } )
193- . pipe ( Effect . provide ( buildLayer ( calls ) ) ) ,
202+ . pipe (
203+ Effect . provide (
204+ buildLayer ( calls , ( initial ) => {
205+ expect ( initial ) . toContain ( '<title>Post</title>' )
206+ expect ( initial ) . toContain ( '<state>publish</state>' )
207+ expect ( initial ) . toContain ( 'post body' )
208+ return initial
209+ } ) ,
210+ ) ,
211+ ) ,
194212 )
195213 expect ( Exit . isSuccess ( exit ) ) . toBe ( true )
196214 expect ( calls ) . toEqual ( [ '/posts/123456789012345' , '/posts/post' ] )
@@ -206,7 +224,16 @@ describe('edit command no-change round trip', () => {
206224 const exit = await Effect . runPromiseExit (
207225 editNote
208226 . handler ( { slugOrId : 'note' , ...commonNoteOptions } )
209- . pipe ( Effect . provide ( buildLayer ( calls ) ) ) ,
227+ . pipe (
228+ Effect . provide (
229+ buildLayer ( calls , ( initial ) => {
230+ expect ( initial ) . toContain ( '<title>Note</title>' )
231+ expect ( initial ) . toContain ( '<state>draft</state>' )
232+ expect ( initial ) . toContain ( 'note body' )
233+ return initial
234+ } ) ,
235+ ) ,
236+ ) ,
210237 )
211238 expect ( Exit . isSuccess ( exit ) ) . toBe ( true )
212239 expect ( calls ) . toEqual ( [
@@ -225,7 +252,15 @@ describe('edit command no-change round trip', () => {
225252 const exit = await Effect . runPromiseExit (
226253 editPage
227254 . handler ( { slugOrId : '123456789012347' , ...commonPageOptions } )
228- . pipe ( Effect . provide ( buildLayer ( calls ) ) ) ,
255+ . pipe (
256+ Effect . provide (
257+ buildLayer ( calls , ( initial ) => {
258+ expect ( initial ) . toContain ( '<title>Page</title>' )
259+ expect ( initial ) . toContain ( 'page body' )
260+ return initial
261+ } ) ,
262+ ) ,
263+ ) ,
229264 )
230265 expect ( Exit . isSuccess ( exit ) ) . toBe ( true )
231266 expect ( calls ) . toEqual ( [ '/pages/123456789012347' ] )
0 commit comments