diff --git a/nix/tests/module.nix b/nix/tests/module.nix index b3de3b3..620d63f 100644 --- a/nix/tests/module.nix +++ b/nix/tests/module.nix @@ -25,6 +25,9 @@ let }; evaluatedConfig = evaluatedSystem.config; landingPage = self.packages.${system}.landing-page; + stylesheetHash = + builtins.substring 0 12 (builtins.hashFile "sha256" ../../site/styles.css); + stylesheetFileName = "styles-${stylesheetHash}.css"; landingVirtualHost = evaluatedConfig.services.nginx.virtualHosts."torahimderecheretz.com"; discourseConfig = evaluatedConfig.services.discourse; backupConfig = evaluatedConfig.services.borgbackup.jobs.discourse; @@ -62,10 +65,23 @@ assert !(evaluatedConfig.services.nginx.virtualHosts ? "tide.yisroelbaum.com"); assert !(evaluatedConfig.services.nginx.virtualHosts ? "apitide.yisroelbaum.com"); pkgs.runCommand "tide-module-test" { } '' test -f ${landingPage}/index.html - test -f ${landingPage}/styles.css + test -f ${landingPage}/${stylesheetFileName} + test ! -e ${landingPage}/styles.css test -f ${landingPage}/robots.txt test -f ${landingPage}/assets/rav-hirsch-1847.jpg test -f ${landingPage}/assets/rav-hirsch-1847.webp + ${pkgs.diffutils}/bin/cmp \ + ${../../site/styles.css} \ + ${landingPage}/${stylesheetFileName} + ${pkgs.gnugrep}/bin/grep -F \ + 'href="/${stylesheetFileName}"' \ + ${landingPage}/index.html + if ${pkgs.gnugrep}/bin/grep -F \ + 'href="/styles.css"' \ + ${landingPage}/index.html; then + echo "unexpected unversioned stylesheet reference" >&2 + exit 1 + fi ${pkgs.gnugrep}/bin/grep -F \ "A Torah vision for the whole of life." \ ${landingPage}/index.html