-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test coverage #24
Comments
related to - nushell/nupm#30 - #24 wait for these to land - nushell/nupm#30 ## description this PR - adds an empty `tests/mod.nu` module so that `nupm test` can work - adds a CI greatly inspired by nushell/nupm#30 - does not need the `CWD` trick for Windows (:pray:) - pulls down Nushell from nightly builds - clones Nupm - shows the version of Nushell - runs the tests
i updated this issue's tasks to reflect the fact that we need tests for the |
as explained in #24 (comment), i encountered a cache bug when working on #39 => because the cache path can now be fully set by the user with `$env.GIT_REPOS_CACHE`, it does not have the `.nuon` extension in general and thus we cannot assume `open $env.GIT_REPOS_CACHE` to open the file as NUON data... ## description in order to allow testing more of the internals of the `gm` commands, i propose in this PR to move the cache logic as much as possible from `gm` itself to a new internal `fs/cache.nu` module. > **Important** > this might sounds like *clean code*, e.g. where you put all the code in nested oneliners... > i would argue it's not the goal of this PR and the fact that the resulting commands are quite small is simply because they are doing quite simple stuff! > the goal here is to move the internal logic out of the public `gm` which exposes the main API to allow testing as much as possible without require to `gm clone` actual repositories or `gm remove` in an interactive manner 😋 ### changelog - move `get-repo-store-cache-path` and `check-cache-file` to a new `fs/cache.nu` module - move most of the cache logic to commands in `fs/cache.nu` - adds tests for the cache functionalities ## tests a new `cache-manipulation` test in `tests/mod.nu`. --------- Co-authored-by: Mel Massadian <[email protected]>
answering you here directly 😌 the idea behind #44 was that there was cache-related logic hardcoded inside the i managed to move this logic to the library out of the public API and the the question is:
such tests could look like gm clone https://github.com/amtoine/nu-git-manager
assert equal (gm list) ["github.com/amtoine/nu-git-manager"] that kind of stuff 😋 |
I would vote for merging this and do a separate PR for testing public commands, I think it makes sense to have test for these too |
i've updated the issue description accordingly => integration / end-to-end tests still need to be addressed 😊 |
related to - #24 ## description in order to be able to test the `gm remove` command: - add `--no-confirm` to `gm remove` in a new `tests/gm.nu` test module, adds - a `run-with-env` command to take care of the test environment wrapping and cleaning - tests for - `gm list` - `gm update-cache` - `gm status` - `gm clone` - `gm remove` - the true expected errors next to `assert error` in NOTE, for when we'll be able to check the content of an error in Nushell 😏
…121) related to - #24 ## description the `./src/nu-git-manager-sugar/` directory structure changed from ``` . |-- extra.nu |-- git-prompt.nu |-- git.nu |-- github.nu `-- mod.nu ``` to ``` . |-- extra.nu |-- git | |-- lib | | |-- lib.nu | | `-- prompt.nu | |-- mod.nu | `-- prompt.nu |-- github.nu `-- mod.nu ``` that is - all the Git commands, e.g. `gm repo ...`, are still exposed as before from `git/mod.nu` - `git-prompt` has been moved to `git/prompt.nu` and the main _setup_ command is now called `nu-git-manager-sugar git prompt setup` - the commands from past `git-prompt.nu` that would need to be tested have been moved to `git/lib/` which is a _private_ module
should - close #24 ## description this PR - adds three tests for the three building blocks of the prompt - `repo-revision` for `get-revision` - `repo-current-action` for `git-action` - `build-left-prompt` for `get-left-prompt` - fixes a bug with `$env.CMD_DURATION` -> when the shell starts its value is `"0823"`, an easter egg of Nushell 😏 - uses sanitized path in `simplify-path` and sanitize paths in `get-left-prompt` for Windows
in the long run, i think we need unit and integration tests, as much as possible 👍
gm
itself #44gm
commands work as expected with real reposgm
commands end to end #48nu-git-manager-sugar
git-prompt
git
andgit-prompt
modules insugar
to allow testing #121The text was updated successfully, but these errors were encountered: