Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions Normal/App/NormalApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ struct NormalApp: App {
let modelContainer: ModelContainer
let services: AppServices

static let models: [any PersistentModel.Type] = [
AppGroup.self,
SelectedApps.self,
Key.self,
BlockSchedule.self,
Settings.self,
UsageLimit.self,
]

init() {
let schema = Schema([
AppGroup.self,
SelectedApps.self,
Key.self,
BlockSchedule.self,
Settings.self,
UsageLimit.self,
])
let schema = Schema(Self.models)
let configuration = ModelConfiguration(
schema: schema,
isStoredInMemoryOnly: UITestSupport.isActive || UITestSupport.isUnitTestHost
Expand Down
8 changes: 2 additions & 6 deletions NormalTests/Models/CustomDomainMigrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import Testing

@MainActor
struct CustomDomainMigrationTests {
private static let models: [any PersistentModel.Type] = [
Key.self, Settings.self, BlockSchedule.self, SelectedApps.self, AppGroup.self,
]

private func storeURL() -> URL {
FileManager.default.temporaryDirectory
.appendingPathComponent("customdomainmig-\(UUID().uuidString).store")
Expand All @@ -26,8 +22,8 @@ struct CustomDomainMigrationTests {

private func makeContainer(at url: URL) throws -> ModelContainer {
try ModelContainer(
for: Schema(Self.models),
configurations: ModelConfiguration(schema: Schema(Self.models), url: url)
for: Schema(NormalApp.models),
configurations: ModelConfiguration(schema: Schema(NormalApp.models), url: url)
)
}

Expand Down
8 changes: 2 additions & 6 deletions NormalTests/Models/GroupKeyCascadeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ import Testing

@MainActor
struct GroupKeyCascadeTests {
private static let models: [any PersistentModel.Type] = [
Key.self, Settings.self, BlockSchedule.self, SelectedApps.self, AppGroup.self,
]

private func makeContainer() throws -> ModelContainer {
try ModelContainer(
for: Schema(Self.models),
configurations: ModelConfiguration(schema: Schema(Self.models), isStoredInMemoryOnly: true)
for: Schema(NormalApp.models),
configurations: ModelConfiguration(schema: Schema(NormalApp.models), isStoredInMemoryOnly: true)
)
}

Expand Down
8 changes: 2 additions & 6 deletions NormalTests/Models/KeyMigrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import Testing

@MainActor
struct KeyMigrationTests {
private static let models: [any PersistentModel.Type] = [
Key.self, Settings.self, BlockSchedule.self, SelectedApps.self, AppGroup.self,
]

private func storeURL() -> URL {
FileManager.default.temporaryDirectory
.appendingPathComponent("keymig-\(UUID().uuidString).store")
Expand All @@ -26,8 +22,8 @@ struct KeyMigrationTests {

private func makeContainer(at url: URL) throws -> ModelContainer {
try ModelContainer(
for: Schema(Self.models),
configurations: ModelConfiguration(schema: Schema(Self.models), url: url)
for: Schema(NormalApp.models),
configurations: ModelConfiguration(schema: Schema(NormalApp.models), url: url)
)
}

Expand Down
Loading
Loading