Skip to content

Commit

Permalink
thunderbird: Enable tests for Darwin (nix-community#6324)
Browse files Browse the repository at this point in the history
  • Loading branch information
booxter authored Jan 17, 2025
1 parent 0dfec9d commit 12851ae
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 19 deletions.
2 changes: 1 addition & 1 deletion tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ in import nmtSrc {
./modules/programs/tealdeer
./modules/programs/texlive
./modules/programs/thefuck
./modules/programs/thunderbird
./modules/programs/tmate
./modules/programs/tmux
./modules/programs/topgrade
Expand Down Expand Up @@ -227,7 +228,6 @@ in import nmtSrc {
./modules/programs/swaylock
./modules/programs/swayr
./modules/programs/terminator
./modules/programs/thunderbird
./modules/programs/tofi
./modules/programs/waybar
./modules/programs/wlogout
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[General]
StartWithLastProfile=1

[Profile0]
Default=1
IsRelative=1
Name=first
Path=Profiles/first

[Profile1]
Default=0
IsRelative=1
Name=second
Path=Profiles/second

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 26 additions & 18 deletions tests/modules/programs/thunderbird/thunderbird.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{ pkgs, ... }: {
imports = [ ../../accounts/email-test-accounts.nix ];

accounts.email.accounts = {
Expand Down Expand Up @@ -38,6 +38,9 @@
programs.thunderbird = {
enable = true;

# Disable warning so that platforms' behavior is the same
darwinSetupWarning = false;

profiles = {
first = {
isDefault = true;
Expand Down Expand Up @@ -67,25 +70,30 @@

test.stubs.thunderbird = { };

nmt.script = ''
assertFileExists home-files/.thunderbird/profiles.ini
assertFileContent home-files/.thunderbird/profiles.ini \
${./thunderbird-expected-profiles.ini}
assertFileExists home-files/.thunderbird/first/user.js
assertFileContent home-files/.thunderbird/first/user.js \
${./thunderbird-expected-first.js}
assertFileExists home-files/.thunderbird/second/user.js
assertFileContent home-files/.thunderbird/second/user.js \
${./thunderbird-expected-second.js}
assertFileExists home-files/.thunderbird/first/chrome/userChrome.css
assertFileContent home-files/.thunderbird/first/chrome/userChrome.css \
nmt.script = let
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
configDir = if isDarwin then "Library/Thunderbird" else ".thunderbird";
profilesDir = if isDarwin then "${configDir}/Profiles" else "${configDir}";
platform = if isDarwin then "darwin" else "linux";
in ''
assertFileExists home-files/${configDir}/profiles.ini
assertFileContent home-files/${configDir}/profiles.ini \
${./thunderbird-expected-profiles-${platform}.ini}
assertFileExists home-files/${profilesDir}/first/user.js
assertFileContent home-files/${profilesDir}/first/user.js \
${./thunderbird-expected-first-${platform}.js}
assertFileExists home-files/${profilesDir}/second/user.js
assertFileContent home-files/${profilesDir}/second/user.js \
${./thunderbird-expected-second-${platform}.js}
assertFileExists home-files/${profilesDir}/first/chrome/userChrome.css
assertFileContent home-files/${profilesDir}/first/chrome/userChrome.css \
<(echo "* { color: blue !important; }")
assertFileExists home-files/.thunderbird/first/chrome/userContent.css
assertFileContent home-files/.thunderbird/first/chrome/userContent.css \
assertFileExists home-files/${profilesDir}/first/chrome/userContent.css
assertFileContent home-files/${profilesDir}/first/chrome/userContent.css \
<(echo "* { color: red !important; }")
'';
}

0 comments on commit 12851ae

Please sign in to comment.