tests/espanso: reorganize darwin and linux
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
c283a23ef6
commit
d2b2c72add
12 changed files with 37 additions and 19 deletions
66
tests/modules/services/espanso/linux/basic-configuration.nix
Normal file
66
tests/modules/services/espanso/linux/basic-configuration.nix
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
espansoExtraArgs: {
|
||||
services.espanso = {
|
||||
enable = true;
|
||||
configs = {
|
||||
default = {
|
||||
show_notifications = false;
|
||||
};
|
||||
};
|
||||
matches = {
|
||||
base = {
|
||||
matches = [
|
||||
{
|
||||
trigger = ":now";
|
||||
replace = "It's {{currentdate}} {{currenttime}}";
|
||||
}
|
||||
{
|
||||
trigger = ":hello";
|
||||
replace = ''
|
||||
line1
|
||||
line2'';
|
||||
}
|
||||
{
|
||||
regex = ":hi(?P<person>.*)\\.";
|
||||
replace = "Hi {{person}}!";
|
||||
}
|
||||
];
|
||||
global_vars = [
|
||||
{
|
||||
name = "currentdate";
|
||||
type = "date";
|
||||
params = {
|
||||
format = "%d/%m/%Y";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "currenttime";
|
||||
type = "date";
|
||||
params = {
|
||||
format = "%R";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
} // espansoExtraArgs;
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/espanso.service
|
||||
expectedServiceFile=${./basic-configuration.service}
|
||||
assertFileExists "$serviceFile"
|
||||
# ensure espanso is in ExecStart
|
||||
assertFileRegex "$serviceFile" 'ExecStart=.*/bin/espanso launcher'
|
||||
# rest of the file should be identical
|
||||
grep -v "/bin/espanso launcher" "$(_abs $serviceFile)" > espanso-service.actual
|
||||
grep -v "/bin/espanso launcher" "$expectedServiceFile" > espanso-service.expected
|
||||
assertFileContent "$(realpath espanso-service.actual)" espanso-service.expected
|
||||
|
||||
configFile=home-files/.config/espanso/config/default.yml
|
||||
assertFileExists "$configFile"
|
||||
assertFileContent "$configFile" ${./basic-configuration.yaml}
|
||||
|
||||
matchFile=home-files/.config/espanso/match/base.yml
|
||||
assertFileExists "$matchFile"
|
||||
assertFileContent "$matchFile" ${./basic-matches.yaml}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue