mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
tests/oh-my-posh: expand test coverage
Cover some more scenarios with the module. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
51372c4afb
commit
10f5a0cc4b
7 changed files with 113 additions and 0 deletions
14
tests/modules/programs/oh-my-posh/assertion-all-three.nix
Normal file
14
tests/modules/programs/oh-my-posh/assertion-all-three.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
programs.oh-my-posh = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
version = 2;
|
||||||
|
};
|
||||||
|
useTheme = "jandedobbeleer";
|
||||||
|
configFile = "/etc/oh-my-posh/custom.json";
|
||||||
|
};
|
||||||
|
|
||||||
|
test.asserts.assertions.expected = [
|
||||||
|
"oh-my-posh: Only one of 'settings', 'useTheme', or 'configFile' can be configured at a time."
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
programs.oh-my-posh = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
version = 2;
|
||||||
|
};
|
||||||
|
configFile = "/etc/oh-my-posh/custom.json";
|
||||||
|
};
|
||||||
|
|
||||||
|
test.asserts.assertions.expected = [
|
||||||
|
"oh-my-posh: Only one of 'settings', 'useTheme', or 'configFile' can be configured at a time."
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
programs.oh-my-posh = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
version = 2;
|
||||||
|
};
|
||||||
|
useTheme = "jandedobbeleer";
|
||||||
|
};
|
||||||
|
|
||||||
|
test.asserts.assertions.expected = [
|
||||||
|
"oh-my-posh: Only one of 'settings', 'useTheme', or 'configFile' can be configured at a time."
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
programs.oh-my-posh = {
|
||||||
|
enable = true;
|
||||||
|
useTheme = "jandedobbeleer";
|
||||||
|
configFile = "/etc/oh-my-posh/custom.json";
|
||||||
|
};
|
||||||
|
|
||||||
|
test.asserts.assertions.expected = [
|
||||||
|
"oh-my-posh: Only one of 'settings', 'useTheme', or 'configFile' can be configured at a time."
|
||||||
|
];
|
||||||
|
}
|
||||||
17
tests/modules/programs/oh-my-posh/config-file.nix
Normal file
17
tests/modules/programs/oh-my-posh/config-file.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
programs = {
|
||||||
|
bash.enable = true;
|
||||||
|
|
||||||
|
oh-my-posh = {
|
||||||
|
enable = true;
|
||||||
|
configFile = "/etc/oh-my-posh/custom.json";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.bashrc
|
||||||
|
assertFileContains \
|
||||||
|
home-files/.bashrc \
|
||||||
|
'/bin/oh-my-posh init bash --config /etc/oh-my-posh/custom.json'
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
@ -3,4 +3,10 @@
|
||||||
oh-my-posh-zsh = ./zsh.nix;
|
oh-my-posh-zsh = ./zsh.nix;
|
||||||
oh-my-posh-fish = ./fish.nix;
|
oh-my-posh-fish = ./fish.nix;
|
||||||
oh-my-posh-nushell = ./nushell.nix;
|
oh-my-posh-nushell = ./nushell.nix;
|
||||||
|
oh-my-posh-settings = ./settings.nix;
|
||||||
|
oh-my-posh-config-file = ./config-file.nix;
|
||||||
|
oh-my-posh-assertion-settings-theme = ./assertion-settings-theme.nix;
|
||||||
|
oh-my-posh-assertion-settings-config-file = ./assertion-settings-config-file.nix;
|
||||||
|
oh-my-posh-assertion-theme-config-file = ./assertion-theme-config-file.nix;
|
||||||
|
oh-my-posh-assertion-all-three = ./assertion-all-three.nix;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
39
tests/modules/programs/oh-my-posh/settings.nix
Normal file
39
tests/modules/programs/oh-my-posh/settings.nix
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
programs = {
|
||||||
|
bash.enable = true;
|
||||||
|
|
||||||
|
oh-my-posh = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
version = 2;
|
||||||
|
final_space = true;
|
||||||
|
blocks = [
|
||||||
|
{
|
||||||
|
type = "prompt";
|
||||||
|
alignment = "left";
|
||||||
|
segments = [
|
||||||
|
{
|
||||||
|
type = "shell";
|
||||||
|
style = "plain";
|
||||||
|
template = "{{ .Name }} ";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/oh-my-posh/config.json
|
||||||
|
assertFileContains \
|
||||||
|
home-files/.config/oh-my-posh/config.json \
|
||||||
|
'"version": 2'
|
||||||
|
assertFileContains \
|
||||||
|
home-files/.config/oh-my-posh/config.json \
|
||||||
|
'"final_space": true'
|
||||||
|
assertFileContains \
|
||||||
|
home-files/.bashrc \
|
||||||
|
'/bin/oh-my-posh init bash --config /home/hm-user/.config/oh-my-posh/config.json'
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue