Accept up2date package parameter
All checks were successful
Build / audit (push) Successful in 16m10s
Build / test (push) Successful in 16m35s

This commit is contained in:
2023-12-11 08:14:55 +01:00
parent e9504fb8e5
commit 6a063b2cc4
7 changed files with 29 additions and 135 deletions

View File

@ -100,55 +100,3 @@ spec = do
given = PackageInfo
"pkgnam" "1.2.3" "homepage" downloads' checksumSample [] [] [] "Z" "test@example.com"
in generate given `shouldBe` Text.decodeUtf8 infoDownload1
describe "updateDownloadVersion" $ do
it "replaces the version" $
let downloads' = maybeToList
$ mkURI "https://dlackware.com/download-1.2.3.tar.gz"
testPackage = PackageInfo
"pkgnam" "1.2.3" "homepage" downloads' checksumSample [] [] [] "Z" "test@example.com"
expected = maybeToList
$ mkURI "https://dlackware.com/download-2.3.4.tar.gz"
actual = updateDownloadVersion testPackage "2.3.4" Nothing
in actual `shouldBe` expected
it "updates the major version" $
let downloads' = maybeToList
$ mkURI "https://dlackware.com/1.2/download.tar.gz"
testPackage = PackageInfo
"pkgnam" "1.2.3" "homepage" downloads' checksumSample [] [] [] "Z" "test@example.com"
expected = maybeToList
$ mkURI "https://dlackware.com/2.3/download.tar.gz"
actual = updateDownloadVersion testPackage "2.3.4" Nothing
in actual `shouldBe` expected
it "updates gnome version" $
let downloads' = maybeToList
$ mkURI "https://download.gnome.org/core/3.36/3.36.0/sources/gnome-calendar-3.36.0.tar.xz"
testPackage = PackageInfo "gnome-calendar" "3.36.0" "https://wiki.gnome.org/Core/Calendar"
downloads' checksumSample [] [] [] "Z" "test@example.com"
expected = maybeToList
$ mkURI "https://download.gnome.org/core/3.36/3.36.4/sources/gnome-calendar-3.36.2.tar.xz"
actual = updateDownloadVersion testPackage "3.36.2" $ Just "3.36.4"
in actual `shouldBe` expected
it "updates versions without a patch number" $
let downloads' = maybeToList
$ mkURI "https://dlackware.com/gnome-contacts-3.36.tar.xz"
testPackage = PackageInfo
"gnome-contacts" "3.36" "homepage" downloads' checksumSample [] [] [] "Z" "test@example.com"
expected = maybeToList
$ mkURI "https://dlackware.com/gnome-contacts-3.36.2.tar.xz"
actual = updateDownloadVersion testPackage "3.36.2" Nothing
in actual `shouldBe` expected
describe "update" $
it "replaces the version" $
let downloads' = maybeToList
$ mkURI "https://dlackware.com/1.2/download.tar.gz"
testPackage = PackageInfo
"pkgnam" "1.2.3" "homepage" downloads' checksumSample [] [] [] "Z" "test@example.com"
expected = PackageInfo
"pkgnam" "2.3.4" "homepage" downloads' checksumSample [] [] [] "Z" "test@example.com"
given = update testPackage "2.3.4" downloads' checksumSample
in given `shouldBe` expected