File tree Expand file tree Collapse file tree 2 files changed +3
-28
lines changed
src/frontend/apps/impress/src/features/service-worker Expand file tree Collapse file tree 2 files changed +3
-28
lines changed Original file line number Diff line number Diff line change @@ -146,20 +146,11 @@ export class ApiPlugin implements WorkboxPlugin {
146146 await RequestSerializer . fromRequest ( this . initialRequest )
147147 ) . toObject ( ) ;
148148
149- if ( ! requestData . body ) {
150- return new Response ( 'Body found' , { status : 404 } ) ;
151- }
152-
153- const jsonObject = RequestSerializer . arrayBufferToJson < Partial < Doc > > (
154- requestData . body ,
155- ) ;
156-
157149 // Add a new doc id to the create request
158150 const uuid = self . crypto . randomUUID ( ) ;
159151 const newRequestData = {
160152 ...requestData ,
161153 body : RequestSerializer . objectToArrayBuffer ( {
162- ...jsonObject ,
163154 id : uuid ,
164155 } ) ,
165156 } ;
@@ -175,16 +166,8 @@ export class ApiPlugin implements WorkboxPlugin {
175166 'doc-mutation' ,
176167 ) ;
177168
178- /**
179- * Create new item in the cache
180- */
181- const bodyMutate = ( await this . initialRequest
182- . clone ( )
183- . json ( ) ) as Partial < Doc > ;
184-
185169 const newResponse : Doc = {
186170 title : '' ,
187- ...bodyMutate ,
188171 id : uuid ,
189172 content : '' ,
190173 created_at : new Date ( ) . toISOString ( ) ,
Original file line number Diff line number Diff line change @@ -346,13 +346,8 @@ describe('ApiPlugin', () => {
346346 headers : new Headers ( {
347347 'Content-Type' : 'application/json' ,
348348 } ) ,
349- arrayBuffer : ( ) =>
350- RequestSerializer . objectToArrayBuffer ( {
351- title : 'my new doc' ,
352- } ) ,
353- json : ( ) => ( {
354- title : 'my new doc' ,
355- } ) ,
349+ arrayBuffer : ( ) => RequestSerializer . objectToArrayBuffer ( { } ) ,
350+ json : ( ) => ( { } ) ,
356351 } as unknown as Request ,
357352 } as any ;
358353
@@ -389,9 +384,7 @@ describe('ApiPlugin', () => {
389384 ) ;
390385 expect ( mockedPut ) . toHaveBeenCalledWith (
391386 'doc-item' ,
392- expect . objectContaining ( {
393- title : 'my new doc' ,
394- } ) ,
387+ expect . objectContaining ( { } ) ,
395388 'http://test.jest/documents/444555/' ,
396389 ) ;
397390 expect ( mockedPut ) . toHaveBeenCalledWith (
@@ -400,7 +393,6 @@ describe('ApiPlugin', () => {
400393 results : expect . arrayContaining ( [
401394 expect . objectContaining ( {
402395 id : '444555' ,
403- title : 'my new doc' ,
404396 } ) ,
405397 ] ) ,
406398 } ) ,
You can’t perform that action at this time.
0 commit comments