diff options
author | Matan Kushner <hello@matchai.dev> | 2020-01-26 17:37:18 -0500 |
---|---|---|
committer | Kevin Song <chipbuster@users.noreply.github.com> | 2020-01-26 16:37:18 -0600 |
commit | 3365beae09af2f12b6323a52f88633ed97b39c51 (patch) | |
tree | fb36ec6c06439edd29775fc4a7b1a06041619b69 /src/modules/battery.rs | |
parent | 5342dcc658110f8884a77ef1b3f83e867322ffb5 (diff) |
test(nodejs): Port nodejs module tests from E2E to integraton (#867)
Replaces the existing nodejs module end-to-end tests with integration tests that don't require preinstalled environmental dependencies.
- Moved the tests to the same file as the module they test
- Created a render_module utility function for rendering modules within tests
- Removed Node.js installation during CI setup
- Add Shell to Context to allow for tests to not run shell-specific code
Diffstat (limited to 'src/modules/battery.rs')
-rw-r--r-- | src/modules/battery.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/modules/battery.rs b/src/modules/battery.rs index 8c651a954..55e248e57 100644 --- a/src/modules/battery.rs +++ b/src/modules/battery.rs @@ -1,13 +1,12 @@ -use super::{Context, Module, RootModuleConfig}; +use super::{Context, Module, RootModuleConfig, Shell}; use crate::configs::battery::BatteryConfig; /// Creates a module for the battery percentage and charging state pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> { // TODO: Update when v1.0 printing refactor is implemented to only // print escapes in a prompt context. - let shell = std::env::var("STARSHIP_SHELL").unwrap_or_default(); - let percentage_char = match shell.as_str() { - "zsh" => "%%", // % is an escape in zsh, see PROMPT in `man zshmisc` + let percentage_char = match context.shell { + Shell::Zsh => "%%", // % is an escape in zsh, see PROMPT in `man zshmisc` _ => "%", }; |