@@ -28,6 +28,7 @@ final class SyncActionsSpec: QuickSpec {
2828 let webDavController : WebDavController = WebDavTestController ( )
2929 var dbStorage : DbStorage !
3030 let disposeBag : DisposeBag = DisposeBag ( )
31+ let myLibrary = Library ( identifier: . custom( . myLibrary) , name: L10n . Libraries. myLibrary, metadataEditable: true , filesEditable: true )
3132
3233 beforeSuite {
3334 let config = Realm . Configuration ( inMemoryIdentifier: " TestsRealmConfig " )
@@ -69,8 +70,10 @@ final class SyncActionsSpec: QuickSpec {
6970 try ! FileManager . default. createMissingDirectories ( for: collectionFile. createUrl ( ) . deletingLastPathComponent ( ) )
7071 try ! collectionData. write ( to: collectionFile. createUrl ( ) )
7172 let searchFile = Files . jsonCacheFile ( for: . search, libraryId: . custom( . myLibrary) , key: " CCCCCCCC " )
73+ try ! FileManager . default. createMissingDirectories ( for: searchFile. createUrl ( ) . deletingLastPathComponent ( ) )
7274 try ! searchData. write ( to: searchFile. createUrl ( ) )
7375 let itemFile = Files . jsonCacheFile ( for: . item, libraryId: . custom( . myLibrary) , key: " AAAAAAAA " )
76+ try ! FileManager . default. createMissingDirectories ( for: itemFile. createUrl ( ) . deletingLastPathComponent ( ) )
7477 try ! itemData. write ( to: itemFile. createUrl ( ) )
7578
7679 // Create response models
@@ -101,6 +104,8 @@ final class SyncActionsSpec: QuickSpec {
101104 creators: [ : ] ,
102105 fields: [ : ] ,
103106 abstract: " New abstract " ,
107+ library: myLibrary,
108+ collections: nil ,
104109 dateModified: Date ( ) ,
105110 dateAdded: Date ( )
106111 )
@@ -111,6 +116,8 @@ final class SyncActionsSpec: QuickSpec {
111116 creators: [ : ] ,
112117 fields: [ : ] ,
113118 abstract: " Some note " ,
119+ library: myLibrary,
120+ collections: nil ,
114121 dateModified: Date ( ) ,
115122 dateAdded: Date ( )
116123 )
@@ -213,6 +220,7 @@ final class SyncActionsSpec: QuickSpec {
213220 try ? FileStorageController ( ) . remove ( Files . jsonCacheFile ( for: . item, libraryId: . custom( . myLibrary) , key: " BBBBBBBB " ) )
214221 // Write original json files to directory folder for SyncActionHandler to use when reverting
215222 let itemFile = Files . jsonCacheFile ( for: . item, libraryId: . custom( . myLibrary) , key: " AAAAAAAA " )
223+ try ! FileManager . default. createMissingDirectories ( for: itemFile. createUrl ( ) . deletingLastPathComponent ( ) )
216224 try ! itemData. write ( to: itemFile. createUrl ( ) )
217225
218226 // Create response models
@@ -358,6 +366,8 @@ final class SyncActionsSpec: QuickSpec {
358366 creators: [ : ] ,
359367 fields: [ : ] ,
360368 abstract: " New abstract " ,
369+ library: myLibrary,
370+ collections: nil ,
361371 dateModified: Date ( ) ,
362372 dateAdded: Date ( )
363373 )
@@ -368,6 +378,8 @@ final class SyncActionsSpec: QuickSpec {
368378 creators: [ : ] ,
369379 fields: [ : ] ,
370380 abstract: " Some note " ,
381+ library: myLibrary,
382+ collections: nil ,
371383 dateModified: Date ( ) ,
372384 dateAdded: Date ( )
373385 )
0 commit comments