mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
tests: add assertions only relevant for the specific test case
This commit is contained in:
parent
726f74d9ec
commit
7f983228fe
5 changed files with 24 additions and 12 deletions
|
|
@ -4,4 +4,7 @@ load lib
|
|||
|
||||
@test 'default config can be switched into' {
|
||||
switch_to_default_config
|
||||
|
||||
assert_command nix-on-droid nix-shell bash vi find
|
||||
assert_no_command dash xonsh zsh
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
load lib
|
||||
|
||||
@test 'flake + h-m + #134 overlays case work' {
|
||||
# start from a known baseline
|
||||
switch_to_default_config
|
||||
# assertions to verify initial state is as expected
|
||||
assert_command vi
|
||||
assert_no_command dash zsh
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
load lib
|
||||
|
||||
@test 'flake example works' {
|
||||
# start from a known baseline
|
||||
switch_to_default_config
|
||||
# assertions to verify initial state is as expected
|
||||
assert_command vi
|
||||
assert_no_command dash unzip
|
||||
assert_no_command unzip
|
||||
|
||||
# set up / build / activate the configuration
|
||||
nix-shell -p gnused --run \
|
||||
"sed \
|
||||
-e s/vim/nano/ \
|
||||
|
|
@ -39,5 +39,5 @@ load lib
|
|||
rm -f ~/.config/nix/nix.conf ~/.config/nixpkgs/flake.nix
|
||||
switch_to_default_config
|
||||
assert_command vi
|
||||
assert_no_command dash unzip
|
||||
assert_no_command unzip
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,17 @@
|
|||
|
||||
load lib
|
||||
|
||||
teardown() {
|
||||
rm -f ~/.config/example
|
||||
}
|
||||
|
||||
@test 'using home-manager works' {
|
||||
# start from a known baseline
|
||||
switch_to_default_config
|
||||
# assertions to verify initial state is as expected
|
||||
assert_command vi
|
||||
assert_no_command dash
|
||||
! [[ -e ~/.config/example ]]
|
||||
[[ ! -e ~/.config/example ]]
|
||||
|
||||
# set up / build / activate the configuration
|
||||
nix-channel --add https://github.com/rycee/home-manager/archive/release-21.11.tar.gz home-manager
|
||||
nix-channel --update
|
||||
cp "$ON_DEVICE_TESTS_DIR/config-h-m.nix" ~/.config/nixpkgs/nix-on-droid.nix
|
||||
|
|
@ -30,5 +34,11 @@ load lib
|
|||
[[ "$output" == success ]]
|
||||
[[ "$status" == 42 ]]
|
||||
|
||||
# check that reverting works too
|
||||
switch_to_default_config
|
||||
assert_command vi
|
||||
assert_no_command unzip
|
||||
|
||||
# file will be still present because home-manager needs to be set up to remove old links
|
||||
[[ -e ~/.config/example ]]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ setup() {
|
|||
|
||||
# restore to pre-testing generation before the start of each test
|
||||
$DEFAULT_ACTIVATE_SCRIPT
|
||||
|
||||
# build and activate the version of nix-on-droid that is subject to test
|
||||
switch_to_default_config
|
||||
}
|
||||
|
||||
assert_command() {
|
||||
|
|
@ -47,7 +50,4 @@ switch_to_default_config() {
|
|||
cat "$CHANNEL_DIR/modules/environment/login/nix-on-droid.nix.default" \
|
||||
> ~/.config/nixpkgs/nix-on-droid.nix
|
||||
nix-on-droid switch
|
||||
|
||||
assert_command nix-on-droid nix-shell bash vi find
|
||||
assert_no_command dash xonsh zsh
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue