1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-30 22:21:02 +01:00

tests/firefox: add bookmark policy to profile bookmarks test

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2025-07-06 11:26:05 -05:00
parent 753ea0b324
commit fd9e55f5fa

View file

@ -2,6 +2,7 @@ modulePath:
{ {
config, config,
lib, lib,
pkgs,
... ...
}: }:
@ -11,12 +12,17 @@ let
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath; firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
darwinPath = "Applications/${cfg.darwinAppName}.app/Contents/Resources";
in in
{ {
imports = [ firefoxMockOverlay ]; imports = [ firefoxMockOverlay ];
config = lib.mkIf config.test.enableBig ( config = lib.mkIf config.test.enableBig (
lib.setAttrByPath modulePath { {
# Required for bookmark policy to get set
home.stateVersion = "19.09";
}
// lib.setAttrByPath modulePath {
enable = true; enable = true;
profiles.bookmarks = { profiles.bookmarks = {
settings = { settings = {
@ -80,7 +86,24 @@ in
}; };
} }
// { // {
nmt.script = '' nmt.script =
let
libDir =
if pkgs.stdenv.hostPlatform.isDarwin then
"${cfg.finalPackage}/${darwinPath}"
else
"${cfg.finalPackage}/lib/${cfg.wrappedPackageName}";
config_file = "${libDir}/distribution/policies.json";
in
''
assertFileExists "${config_file}"
noDefaultBookmarks_actual_value="$(${lib.getExe pkgs.jq} ".policies.NoDefaultBookmarks" ${config_file})"
if [[ $noDefaultBookmarks_actual_value != "false" ]]; then
fail "Expected '${config_file}' to set 'policies.NoDefaultBookmarks' to false"
fi
bookmarksUserJs=$(normalizeStorePaths \ bookmarksUserJs=$(normalizeStorePaths \
"home-files/${cfg.profilesPath}/bookmarks/user.js") "home-files/${cfg.profilesPath}/bookmarks/user.js")