From aa5cd7681739a17ca3c4d6b08387387334dbaeb2 Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Wed, 6 Dec 2023 09:37:54 +0100 Subject: [PATCH] Add migration tests for Bookmarks model v5 (#588) Task/Issue URL: https://app.asana.com/0/414709148257752/1206106768488096/f Description: Update BookmarkMigrationTests with a test for migration from V4 to V5. --- Package.swift | 5 ++++- .../BookmarksTests/BookmarkMigrationTests.swift | 6 +++++- .../Resources/Bookmarks_V4.sqlite | Bin 0 -> 57344 bytes .../Resources/Bookmarks_V4.sqlite-shm | Bin 0 -> 32768 bytes .../Resources/Bookmarks_V4.sqlite-wal | Bin 0 -> 41232 bytes 5 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 Tests/BookmarksTests/Resources/Bookmarks_V4.sqlite create mode 100644 Tests/BookmarksTests/Resources/Bookmarks_V4.sqlite-shm create mode 100644 Tests/BookmarksTests/Resources/Bookmarks_V4.sqlite-wal diff --git a/Package.swift b/Package.swift index 89eddfd63..fa8c4e038 100644 --- a/Package.swift +++ b/Package.swift @@ -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", diff --git a/Tests/BookmarksTests/BookmarkMigrationTests.swift b/Tests/BookmarksTests/BookmarkMigrationTests.swift index 3f13e1d94..baae0fb03 100644 --- a/Tests/BookmarksTests/BookmarkMigrationTests.swift +++ b/Tests/BookmarksTests/BookmarkMigrationTests.swift @@ -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) @@ -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") diff --git a/Tests/BookmarksTests/Resources/Bookmarks_V4.sqlite b/Tests/BookmarksTests/Resources/Bookmarks_V4.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..248921609f6f913e179bc90c25d5158ca29a582d GIT binary patch literal 57344 zcmeI%2{@E%-vIC#gF*JaBxB8*Jxj>cju0_Qk#djHGsbaB=X3bBYPFC=^m zA;@O>!Ag_$7Dw4*c z1%%TnRA*OPJQ0V*IpAmR3*$WSSTY_%#@Z0^n3-oV>J%!@)rE|AA!BTat~MI0=b&X2 z6_KgfF9GpntSy#|WmlTs6Z$&X^l?roFT4kd;Oc@Qup`>zJuq$_1ZS*=FUAS)tIfWz zrzgP{my3euL`+{F(@aGv$ z4xFa^&HY`l&iF6)=iHj)>BdfS`eM!jXRObcqDHDVKU&693zc30Z(}Va` zY=Q43$gcA3lsG5;ngpBhKg(4cjh0!$&UNkI=E@!^UnR@`-DEkV>zja|#@+uSU3Ffx zj5|AB+PBkXd}kc+{rk-SQvKVF_|Ifzc+fIV>?g=+I#qo;te2|?fs7|nDbyK-Ph)cC z5%gC{&bW5wWz^4unZrCI9Ot?FvjXQy`lDp$O0;Fq3L2>hZnTU&8&U3aX0sm^D#Z=! z!G3B!hySYQd1t5g?`nRV?sII7R7FMQZ?x>o zgfXktq?t$UT%G>(m~m#t>^KW>nrwDJ4UC2fikH*3h);mA(c$dHDwP(;Vty*m?q2e$BVEzAJVTGU|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%;>d~~x}m6|cjyy2zS#%+9s!RsroHKok2Xpxt`Gt{+FSdO^Su=}3&L(x^O z|2%PZ*&B-1I<<-|h@#v7SakJ)aPWmgp*wy2o?|aqq{WM;71`(5E+Qf4*ho2;(rD<^g9I|r7YWWMFL+NRL_X#C~7jAV_*-P9)C;pY#v-fEuRKy5|8 z(^I%7bT)%IY%(tQ&e>x4`EcEY$b{?5D-*gC)i2QR>fYu|9hjny;zpI9@l5(ow!~K# z^{whts9PGcwj-q}{i0D@^zBC znmot`Wzv@24X;&4WY+@137d7ZKD6i4*%R1snb-L^LG3!VN zra#C(zCD(nzg#W9GdCu8xw3AKce~cGd1CEy-PObPLv2HC!?!0$6NVED5~~L^p664u zsd>~aYOY9U+pxrh?>pSPGs)PoEZq)osr^Bk61g3YN3yFW)iW;6r|&bM`W~zzQ+CA< zYYfk&@3>m>j5MjGtG+OI(eN)Z&X?UbR%VR&{ob&7tOYtjTe9$@c*gTJ(%Kq!} zBd8JFh)XT*_5rIy3*6QoUf{9gVB7TvBmE;wM&6H@yhH1Cz0s@D{o~=^y&Ec2 z!zwAK7W>HUcfJ`@n|#<>>-y&7<&?uGY?hUuG{%K>Q)-3!Ec?77@=q*#dR=(sm9WNc z|1SS)!l4_FEBEP-T8^SdkKZgWy77CJ-;J|zrt)d>iQ5adhuU}5+^IQV(_Pb1bE~HL e#nHh02O4di+k4JW^@iWny(MI_X8yvDBL4!e={Exa literal 0 HcmV?d00001 diff --git a/Tests/BookmarksTests/Resources/Bookmarks_V4.sqlite-shm b/Tests/BookmarksTests/Resources/Bookmarks_V4.sqlite-shm new file mode 100644 index 0000000000000000000000000000000000000000..0738e5302878e05a53647f04879dd37338387f63 GIT binary patch literal 32768 zcmeI*Jx&5)6a~-`9ON&=U?HU&a3}16P1w`ZvIsX|;|i>xCNZ&?Ew})Dj}T&OiSOLx zW+s!FuQ&_1v*@0iOfP!VH234U&Z6u0&-U>3@UeY){XWjS)#HA%d~2U}i$A^}N1c-A z9)IQh_;Q)XT|asoZKH$eU33^7Mf3YfR0t3tK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5;& zYZl1GBOy>zAh))JKuv*MnG*sv1#(|e2-FnFWl7{KwFoq7A_J>z~^8!$!+-b`9N>~0ppTSE)Qi{M3XwZ%k2(baUdc&dnq zmnznJ@X~{aNDp4B2tq3@m~I8NpdMlQJ4&VFA&IgvW5Esa6rhg)#A+XCaP{-Im-D~qt%!+{~l&;_j8?v`R;5n%;3>oetO{z z{V<{=8ND{l+_qM0A`4w{8DXCNW$b7+n-hAVZ>)UTN7K{OoAZ8OSbjO=ZETngt?5I_I{ z1Q0*~0R#|0009ILKwxMD5~H