mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-08 01:50:42 +00:00
Compare commits
3 Commits
26.2.7
...
renovate/s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8640df3b59 | ||
| 765c2fce72 | |||
| 88eceaf194 |
2
.github/workflows/linters.yml
vendored
2
.github/workflows/linters.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Yarn Lock Changes
|
||||
uses: Simek/yarn-lock-changes@c7543145aaafdd8fc925cea5d85b2bd5a73091f8 # v0.14.0
|
||||
uses: Simek/yarn-lock-changes@59f47ee499424d2c2437c5aebf863b5c6d50a5bc # v0.14.1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ section_install()
|
||||
|
||||
cheat-databases)
|
||||
msgr run "Installing cheat databases..."
|
||||
for database in "$DOTFILES"/scripts/install-cheat-*; do
|
||||
for database in "$DOTFILES"/scripts/install-cheat-*.sh; do
|
||||
bash "$database" \
|
||||
&& msgr run_done "Cheat: $database run"
|
||||
done
|
||||
|
||||
133
tests/dfm.bats
133
tests/dfm.bats
@@ -5,8 +5,141 @@ setup()
|
||||
export DOTFILES="$PWD"
|
||||
}
|
||||
|
||||
# ── Group 1: Main help & routing ──────────────────────────────
|
||||
|
||||
@test "dfm help shows usage" {
|
||||
run bash local/bin/dfm help
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"Usage: dfm"* ]]
|
||||
}
|
||||
|
||||
@test "dfm with no args shows full usage with all sections" {
|
||||
run bash local/bin/dfm
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"Usage: dfm"* ]]
|
||||
[[ "$output" == *"dfm install"* ]]
|
||||
[[ "$output" == *"dfm check"* ]]
|
||||
[[ "$output" == *"dfm helpers"* ]]
|
||||
[[ "$output" == *"dfm docs"* ]]
|
||||
[[ "$output" == *"dfm dotfiles"* ]]
|
||||
[[ "$output" == *"dfm scripts"* ]]
|
||||
}
|
||||
|
||||
@test "dfm with invalid section shows usage" {
|
||||
run bash local/bin/dfm nonexistent
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"Usage: dfm"* ]]
|
||||
}
|
||||
|
||||
# ── Group 2: Install menu completeness ────────────────────────
|
||||
|
||||
@test "dfm install menu shows all entries" {
|
||||
run bash local/bin/dfm install
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"all"* ]]
|
||||
[[ "$output" == *"apt-packages"* ]]
|
||||
[[ "$output" == *"cargo"* ]]
|
||||
[[ "$output" == *"cheat-databases"* ]]
|
||||
[[ "$output" == *"composer"* ]]
|
||||
[[ "$output" == *"dnf-packages"* ]]
|
||||
[[ "$output" == *"fonts"* ]]
|
||||
[[ "$output" == *"gh"* ]]
|
||||
[[ "$output" == *"git-crypt"* ]]
|
||||
[[ "$output" == *"go"* ]]
|
||||
[[ "$output" == *"imagick"* ]]
|
||||
[[ "$output" == *"macos"* ]]
|
||||
[[ "$output" == *"npm-packages"* ]]
|
||||
[[ "$output" == *"ntfy"* ]]
|
||||
[[ "$output" == *"nvm-latest"* ]]
|
||||
[[ "$output" == *"nvm"* ]]
|
||||
[[ "$output" == *"python-packages"* ]]
|
||||
[[ "$output" == *"xcode-cli-tools"* ]]
|
||||
[[ "$output" == *"z"* ]]
|
||||
}
|
||||
|
||||
@test "dfm install with invalid subcommand shows menu" {
|
||||
run bash local/bin/dfm install nonexistent
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"dfm install"* ]]
|
||||
}
|
||||
|
||||
# ── Group 3: Other section menus ──────────────────────────────
|
||||
|
||||
@test "dfm helpers menu shows entries" {
|
||||
run bash local/bin/dfm helpers
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"aliases"* ]]
|
||||
[[ "$output" == *"colors"* ]]
|
||||
[[ "$output" == *"path"* ]]
|
||||
[[ "$output" == *"env"* ]]
|
||||
}
|
||||
|
||||
@test "dfm docs menu shows entries" {
|
||||
run bash local/bin/dfm docs
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"all"* ]]
|
||||
[[ "$output" == *"tmux"* ]]
|
||||
[[ "$output" == *"nvim"* ]]
|
||||
[[ "$output" == *"wezterm"* ]]
|
||||
}
|
||||
|
||||
@test "dfm dotfiles menu shows entries" {
|
||||
run bash local/bin/dfm dotfiles
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"fmt"* ]]
|
||||
[[ "$output" == *"shfmt"* ]]
|
||||
[[ "$output" == *"yamlfmt"* ]]
|
||||
}
|
||||
|
||||
@test "dfm check menu shows entries" {
|
||||
run bash local/bin/dfm check
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"arch"* ]]
|
||||
[[ "$output" == *"host"* ]]
|
||||
}
|
||||
|
||||
@test "dfm scripts menu lists install scripts" {
|
||||
run bash local/bin/dfm scripts
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"cargo-packages"* ]]
|
||||
[[ "$output" == *"fonts"* ]]
|
||||
[[ "$output" == *"z"* ]]
|
||||
}
|
||||
|
||||
@test "dfm tests menu shows entries" {
|
||||
run bash local/bin/dfm tests
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"msgr"* ]]
|
||||
[[ "$output" == *"params"* ]]
|
||||
}
|
||||
|
||||
# ── Group 4: Check commands ───────────────────────────────────
|
||||
|
||||
@test "dfm check arch returns current arch" {
|
||||
run bash local/bin/dfm check arch
|
||||
[ "$status" -eq 0 ]
|
||||
[ -n "$output" ]
|
||||
}
|
||||
|
||||
@test "dfm check arch with matching value exits 0" {
|
||||
local current_arch
|
||||
current_arch="$(uname)"
|
||||
run bash local/bin/dfm check arch "$current_arch"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "dfm check arch with non-matching value exits 1" {
|
||||
run bash local/bin/dfm check arch FakeArch
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "dfm check host returns current hostname" {
|
||||
run bash local/bin/dfm check host
|
||||
[ "$status" -eq 0 ]
|
||||
[ -n "$output" ]
|
||||
}
|
||||
|
||||
@test "dfm check host with non-matching value exits 1" {
|
||||
run bash local/bin/dfm check host fakehostname
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user