11import * as Y from 'yjs' ;
2- import { describe , test , expect , vi , afterEach } from " vitest" ;
3- import request from " supertest" ;
2+ import { describe , test , expect , vi , afterEach } from ' vitest' ;
3+ import request from ' supertest' ;
44
55import { mockTokenPayload } from '../../assets/jwt.ts' ;
66import { initWsApp } from '../core/express.ts' ;
@@ -15,8 +15,7 @@ const wsApp = initWsApp(
1515 ( ) => { } ,
1616) ;
1717
18-
19- describe ( "doc" , ( ) => {
18+ describe ( 'doc' , ( ) => {
2019 const verifyJwtSpy = vi . spyOn ( jwt , 'verifyJwt' ) ;
2120 const s3FetchSpy = vi . spyOn ( s3Extension . configuration , 'fetch' ) ;
2221
@@ -25,46 +24,46 @@ describe("doc", () => {
2524 s3FetchSpy . mockClear ( ) ;
2625 } ) ;
2726
28- test ( " GET /documents/ with incorrect document format" , async ( ) => {
27+ test ( ' GET /documents/ with incorrect document format' , async ( ) => {
2928 verifyJwtSpy . mockResolvedValueOnce ( mockTokenPayload ) ;
3029
3130 const res = await request ( wsApp )
32- . get ( " /documents/doc_v1_9999" )
33- . set ( " Authorization" , " Bearer my-valid-token" )
31+ . get ( ' /documents/doc_v1_9999' )
32+ . set ( ' Authorization' , ' Bearer my-valid-token' ) ;
3433
3534 expect ( verifyJwtSpy ) . toHaveBeenCalledOnce ( ) ;
3635
3736 expect ( res . status ) . toBe ( 422 ) ;
3837 expect ( res . body ) . toStrictEqual ( {
39- " message" : " Validation failed" ,
40- " details" : {
41- " name" : {
42- " message" : " Document name should start with \ "document\"" ,
43- " value" : " doc_v1_9999" ,
44- }
38+ message : ' Validation failed' ,
39+ details : {
40+ name : {
41+ message : ' Document name should start with "document"' ,
42+ value : ' doc_v1_9999' ,
43+ } ,
4544 } ,
4645 } ) ;
4746 } ) ;
4847
49- test ( " GET /documents/ with non existing document" , async ( ) => {
48+ test ( ' GET /documents/ with non existing document' , async ( ) => {
5049 verifyJwtSpy . mockResolvedValueOnce ( mockTokenPayload ) ;
5150 s3FetchSpy . mockResolvedValueOnce ( null ) ;
5251
5352 const res = await request ( wsApp )
54- . get ( " /documents/document_v1_8888" )
55- . set ( " Authorization" , " Bearer my-valid-token" )
53+ . get ( ' /documents/document_v1_8888' )
54+ . set ( ' Authorization' , ' Bearer my-valid-token' ) ;
5655
5756 expect ( verifyJwtSpy ) . toHaveBeenCalledOnce ( ) ;
5857 expect ( s3FetchSpy ) . toHaveBeenCalledOnce ( ) ;
5958
6059 expect ( res . status ) . toBe ( 404 ) ;
6160 expect ( res . body ) . toStrictEqual ( {
62- " details" : " Document not found" ,
63- " message" : " Resource not found" ,
61+ details : ' Document not found' ,
62+ message : ' Resource not found' ,
6463 } ) ;
6564 } ) ;
6665
67- test ( " GET /doc/ with existing document" , async ( ) => {
66+ test ( ' GET /doc/ with existing document' , async ( ) => {
6867 verifyJwtSpy . mockResolvedValueOnce ( mockTokenPayload ) ;
6968
7069 const doc = new Y . Doc ( ) ;
@@ -73,8 +72,8 @@ describe("doc", () => {
7372 s3FetchSpy . mockResolvedValueOnce ( binaryData ) ;
7473
7574 const res = await request ( wsApp )
76- . get ( " /documents/document_v1_9999" )
77- . set ( " Authorization" , " Bearer my-valid-token" )
75+ . get ( ' /documents/document_v1_9999' )
76+ . set ( ' Authorization' , ' Bearer my-valid-token' ) ;
7877
7978 expect ( verifyJwtSpy ) . toHaveBeenCalledOnce ( ) ;
8079 expect ( s3FetchSpy ) . toHaveBeenCalledOnce ( ) ;
@@ -90,12 +89,12 @@ describe("doc", () => {
9089 } ,
9190 // NOTE: Added by default
9291 summary_satellite_sensors : {
93- " children" : [
92+ children : [
9493 {
95- type : "p" ,
94+ type : 'p' ,
9695 children : [
9796 {
98- " text" : "" ,
97+ text : '' ,
9998 } ,
10099 ] ,
101100 } ,
0 commit comments