Skip to content

Commit

Permalink
More DB tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
oxtoacart committed Sep 27, 2023
1 parent 312076f commit 0919d4b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 7 deletions.
1 change: 1 addition & 0 deletions DBModule/Sources/DBModule/Database.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public struct DatabaseFactory {
userInfo: [NSLocalizedDescriptionKey: "Database path cannot be blank"])
}
let connection = try! Connection(databasePath)
connection.trace { print($0) }
return DatabaseManager(database: connection)
}
}
Expand Down
9 changes: 8 additions & 1 deletion DBModule/Sources/DBModule/ValueUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ public class ValueUtil {
case TYPE_BYTES:
if let bytes = arg.bytes() {
let byteArray = [UInt8](bytes)
bindings.append(Blob(bytes: byteArray))
let str = String(bytes: byteArray, encoding: .utf8)!
if str == "T/messages/%" && false {
print("Appending as string \(str)")
bindings.append("%")
} else {
print("Appending as bytes \(str)")
bindings.append(Blob(bytes: byteArray))
}
} else {
bindings.append(nil)
}
Expand Down
40 changes: 35 additions & 5 deletions DBModule/Tests/DBModuleTests/DBModuleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,46 @@ final class DBModuleTests: XCTestCase, TestsupportTestingTProtocol {
continueAfterFailure = false
}

// func testList() throws {
// let db = try newDB()
// TestsupportTestList(self, db)
// }

func testTransactions() throws {
let db = try newDB()
TestsupportTestTransactions(self, db)
}

func testSubscriptions() throws {
let db = try newDB()
TestsupportTestSubscriptions(self, db)
}

func testSubscribeToInitialDetails() throws {
let db = try newDB()
TestsupportTestSubscribeToInitialDetails(self, db)
}

func testDetailSubscriptionModifyDetails() throws {
let db = try newDB()
TestsupportTestDetailSubscriptionModifyDetails(self, db)
}

func testDetailSubscriptionModifyIndex() throws {
let db = try newDB()
TestsupportTestDetailSubscriptionModifyIndex(self, db)
}

func testList() throws {
let db = try newDB()
TestsupportTestList(self, db)
}

func testSearch() throws {
let db = try newDB()
TestsupportTestSearch(self, db)
}

func testSearchChinese() throws {
let db = try newDB()
TestsupportTestSearchChinese(self, db)
}

private func newDB() throws -> MinisqlDBProtocol {
return try DatabaseFactory.getDbManager(databasePath: newDBPath())
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/getlantern/android-lantern
go 1.19

// replace github.com/getlantern/flashlight/v7 => ../flashlight
// replace github.com/getlantern/pathdb => ../pathdb
// replace github.com/getlantern/pathdb => ../pathdbx

// replace github.com/getlantern/fronted => ../fronted

Expand Down

0 comments on commit 0919d4b

Please sign in to comment.