@@ -6,18 +6,18 @@ import { APIError, IsEmptyApiResponse } from "../types/general";
6
6
// filesystemConsistencyTests ensure that the contract maintained between the frontend and backend regarding endpoint input/response types are consistent
7
7
// note: requires the BE container to be up and running
8
8
const hasFieldOfType = ( o : any , fieldName : string , type : string ) : boolean =>
9
- fieldName in o && typeof o . fieldName == type ;
9
+ fieldName in o && ( typeof o [ fieldName ] ) = == type ;
10
10
11
11
const IsFilesystemEntry = ( o : any ) : o is FilesystemEntry =>
12
12
hasFieldOfType ( o , "EntityID" , "string" ) &&
13
13
hasFieldOfType ( o , "EntityName" , "string" ) &&
14
14
hasFieldOfType ( o , "IsDocument" , "boolean" ) &&
15
15
hasFieldOfType ( o , "Parent" , "string" ) &&
16
16
hasFieldOfType ( o , "Children" , typeof [ ] ) &&
17
- o . Children . all ( ( child : any ) => IsFilesystemEntry ( child ) ) ;
17
+ o . Children . every ( ( child : any ) => IsFilesystemEntry ( child ) ) ;
18
18
19
19
const IsCreateFilesystemEntryResponse = ( o : any ) : o is CreateFilesystemEntryResponse =>
20
- hasFieldOfType ( o , "EntityID " , "string" ) ;
20
+ hasFieldOfType ( o , "NewID " , "string" ) ;
21
21
22
22
beforeAll ( ( ) => {
23
23
configureApiUrl ( "http://localhost:8080" )
@@ -43,12 +43,14 @@ describe("the filesystem api should", () => {
43
43
const root = ( await FilesystemAPI . GetRootInfo ( ) ) as FilesystemEntry ;
44
44
45
45
// Create a document
46
- const newDocument = await FilesystemAPI . CreateDocument ( "NewDoc" , root . EntityID ) ;
47
- expect ( IsCreateFilesystemEntryResponse ( newDocument ) , "Expected CreateDocument response to be assignable to CreateFilesystemEntryResponse" ) ;
46
+ const newDocument = await FilesystemAPI . CreateDocument ( "ebic document of truth" , root . EntityID ) ;
47
+ console . log ( newDocument ) ;
48
+ expect ( IsCreateFilesystemEntryResponse ( newDocument ) , "Expected CreateDocument response to be assignable to CreateFilesystemEntryResponse" ) . toBe ( true ) ;
48
49
49
50
// fetch the information
50
- const newEntityId = ( newDocument as CreateFilesystemEntryResponse ) . EntityID ;
51
+ const newEntityId = ( newDocument as CreateFilesystemEntryResponse ) . NewID ;
51
52
const documentInformation = await FilesystemAPI . GetEntityInfo ( newEntityId ) ;
53
+ console . log ( newEntityId , documentInformation ) ;
52
54
expect ( IsFilesystemEntry ( documentInformation ) , 'Expected document information to be assignable to the FilesystemEntry type' ) . toBe ( true ) ;
53
55
54
56
// rename it
0 commit comments