Closed wibed closed 1 year ago
If you know the names of the migrations in the test why not just call them directly rather than implementing a whole stack?
// use case isolated within its own "testworld", implying a baseline of data for "functionality"
func testContract() async throws {
var testWorld = testWorld(app)
let baseURI = RouteMap.contractRoute
let baseURIString = baseURI.description
let _app = testWorld.app
// use case related migrations
let migration = Person.MigrationTestWorldUser()
_app.migrations.add(migration)
try await _app.autoMigrate()
// tests
try await contractRegister(&testWorld, uri: baseURIString)
try await contractSearch(testWorld, uri: baseURIString)
try await contractFind(testWorld, uri: baseURIString)
try await contractModify(testWorld, uri: baseURIString)
try await contractRemove(testWorld, uri: baseURIString)
try await migration.revert(on: app.db).get()
}
call me stupid. you are right!
implement stack like behaviour for migrations.
possible usecase: to micro manage db state inbetween unit tests
this is completely wip and i just wanted to get some feedback before i flesh something out.
example code: