@@ -213,7 +213,6 @@ final class KotlinPowerSyncDatabaseImplTests: XCTestCase {
213
213
}
214
214
}
215
215
216
-
217
216
let resultsStore = ResultsStore ( )
218
217
219
218
let stream = try database. watch (
@@ -242,7 +241,6 @@ final class KotlinPowerSyncDatabaseImplTests: XCTestCase {
242
241
sql: " INSERT INTO users (id, name, email) VALUES (?, ?, ?) " ,
243
242
parameters
: [ " 2 " , " User 2 " , " [email protected] " ]
244
243
)
245
-
246
244
247
245
await fulfillment ( of: [ expectation] , timeout: 5 )
248
246
watchTask. cancel ( )
@@ -433,4 +431,41 @@ final class KotlinPowerSyncDatabaseImplTests: XCTestCase {
433
431
""" )
434
432
}
435
433
}
434
+
435
+ func testFTS( ) async throws {
436
+ let supported = try await database. get (
437
+ " SELECT sqlite_compileoption_used('ENABLE_FTS5'); "
438
+ ) { cursor in
439
+ cursor. getLong ( index: 0 )
440
+ }
441
+
442
+ XCTAssertEqual ( supported, 1 )
443
+ }
444
+
445
+ func testUpdatingSchema( ) async throws {
446
+ _ = try await database. execute (
447
+ sql: " INSERT INTO users (id, name, email) VALUES (?, ?, ?) " ,
448
+ parameters
: [ " 1 " , " Test User " , " [email protected] " ]
449
+ )
450
+
451
+ let newSchema = Schema ( tables: [
452
+ Table (
453
+ name: " users " ,
454
+ columns: [
455
+ . text( " name " ) ,
456
+ . text( " email " ) ,
457
+ ] ,
458
+ viewNameOverride: " people "
459
+ ) ,
460
+ ] )
461
+
462
+ try await database. updateSchema ( schema: newSchema)
463
+
464
+ let peopleCount = try await database. get (
465
+ sql: " SELECT COUNT(*) FROM people " ,
466
+ parameters: [ ]
467
+ ) { cursor in cursor. getLong ( index: 0 ) }
468
+
469
+ XCTAssertEqual ( peopleCount, 1 )
470
+ }
436
471
}
0 commit comments