Skip to content

Commit

Permalink
Add migration tests for Bookmarks model v5 (#588)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/414709148257752/1206106768488096/f

Description:
Update BookmarkMigrationTests with a test for migration from V4 to V5.
  • Loading branch information
ayoy authored Dec 6, 2023
1 parent bba78df commit aa5cd76
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ let package = Package(
.copy("Resources/Bookmarks_V2.sqlite-wal"),
.copy("Resources/Bookmarks_V3.sqlite"),
.copy("Resources/Bookmarks_V3.sqlite-shm"),
.copy("Resources/Bookmarks_V3.sqlite-wal")
.copy("Resources/Bookmarks_V3.sqlite-wal"),
.copy("Resources/Bookmarks_V4.sqlite"),
.copy("Resources/Bookmarks_V4.sqlite-shm"),
.copy("Resources/Bookmarks_V4.sqlite-wal")
]),
.testTarget(
name: "BrowserServicesKitTests",
Expand Down
6 changes: 5 additions & 1 deletion Tests/BookmarksTests/BookmarkMigrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ class BookmarkMigrationTests: XCTestCase {
try commonMigrationTestForDatabase(name: "Bookmarks_V3")
}

func testWhenMigratingFromV4ThenRootFoldersContentsArePreservedInOrder() throws {
try commonMigrationTestForDatabase(name: "Bookmarks_V4")
}

func commonMigrationTestForDatabase(name: String) throws {

try copyDatabase(name: name, formDirectory: resourceURLDir, toDirectory: location)
Expand Down Expand Up @@ -131,7 +135,7 @@ class BookmarkMigrationTests: XCTestCase {
try? migratedStack.tearDown(deleteStores: true)
}

func atestThatMigrationToFormFactorSpecificFavoritesAddsFavoritesToNativeFolder() async throws {
func testThatMigrationToFormFactorSpecificFavoritesAddsFavoritesToNativeFolder() async throws {

guard let bookmarksDatabase = loadDatabase(name: "Any") else {
XCTFail("Failed to load model")
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit aa5cd76

Please sign in to comment.