Skip to content

Commit

Permalink
test gm remove
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoine committed Nov 5, 2023
1 parent 59c0bba commit 0d15ba1
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/gm.nu
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,47 @@ export def status [] {
assert equal $actual $expected
}
}

export def remove [] {
run-with-env --prepare-cache {
gm clone https://github.com/amtoine/nu-git-manager --depth 1
gm clone https://github.com/nushell/nupm --depth 1

assert equal (gm list) ["github.com/amtoine/nu-git-manager", "github.com/nushell/nupm"]

# NOTE: true error
# ```
# Error: × no_matching_repository
# ╭─[entry #8:1:1]
# 1 │ gm remove "foo"
# · ──┬──
# · ╰── no repository matching this in .../repos
# ╰────
# ```
assert error { gm remove "not-in-store" --no-confirm }

# NOTE: true error
# ```
# Error: × invalid_arguments_and_options:
# │ no search pattern will match all projects and `--no-confirm` won't remove multiple directories
# ```
assert error { gm remove --no-confirm }

# NOTE: true error
# ```
# Error: × invalid_arguments_and_options
# ╭─[entry #3:1:1]
# 1 │ gm remove github --no-confirm
# · ───┬──
# · ╰── this pattern is too broad, multiple repos won't be removed by `--no-confirm`
# ╰────
# ```
assert error { gm remove "github" --no-confirm }

gm remove "github.com/amtoine/nu-git-manager" --no-confirm
assert equal (gm list) ["github.com/nushell/nupm"]

gm remove "github.com/nushell/nupm" --no-confirm
assert equal (gm list) []
}
}

0 comments on commit 0d15ba1

Please sign in to comment.