Skip to content

Add XCTFluent module with TestDatabase

Pre-release
Pre-release
Compare
Choose a tag to compare
@tanner0101 tanner0101 released this 06 Mar 16:10
1aed57c
This patch was authored by @mattpolzin and released by @tanner0101.

Adds new XCTFluent module for testing. This includes a TestDatabase helper that lets you mock the row results for each query (#110).

let db = TestDatabase()
db.append(queryResult: [])
db.append(queryResult: [
    TestOutput(["id": ..., "name": "Earth"])
])

try Planet.query(on: db).all().wait() // []
try Planet.query(on: db).all().wait() // [Planet(id: ..., name: "Earth")]