# run the tests with nixt -v { pkgs ? import { }, nixt }: let inherit (import ./update-utils.nix { inherit (pkgs) lib; }) extractLatestVersionFromHtml extractSha256FromHtml getLatestStableVersion; in nixt.mkSuite "LibreOffice Updater" { "should extract latest stable version from html" = let latestVersionHtmlMock = '' Index of /libreoffice/stable

Index of /libreoffice/stable

 NameLast modifiedSizeMetadata

 Parent Directory  -  
 7.2.7/10-Mar-2022 11:12 -  
 7.3.3/12-May-2022 10:06 -  
 7.2.6/05-May-2022 07:57 -  

Apache Server at download.documentfoundation.org Port 80

MirrorBrain powered by Apache
''; actual = extractLatestVersionFromHtml latestVersionHtmlMock; in "7.3.3" == actual; "should extract latest stable version from website" = (builtins.compareVersions getLatestStableVersion "7.3.3") >= 0; "should extract sha256 from html" = let sha256Html = "50ed3deb8d9c987516e2687ebb865bca15486c69da79f1b6d74381e43f2ec863 LibreOffice_7.3.3_MacOS_aarch64.dmg\n"; actual = extractSha256FromHtml sha256Html; in "50ed3deb8d9c987516e2687ebb865bca15486c69da79f1b6d74381e43f2ec863" == actual; }