Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Dec 15, 2024
1 parent 92e94ef commit 4d643a0
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 22 deletions.
3 changes: 2 additions & 1 deletion crates/cli/tests/alias_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ mod alias_global {
.arg("node")
.arg("example")
.arg("19.0.0")
.arg("--global");
.arg("--to")
.arg("global");
})
.success();

Expand Down
27 changes: 22 additions & 5 deletions crates/cli/tests/pin_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ mod pin_global {

sandbox
.run_bin(|cmd| {
cmd.arg("pin").arg("--global").arg("node").arg("19.0.0");
cmd.arg("pin")
.arg("--to")
.arg("global")
.arg("node")
.arg("19.0.0");
})
.success();

Expand All @@ -174,7 +178,11 @@ mod pin_global {

sandbox
.run_bin(|cmd| {
cmd.arg("pin").arg("--global").arg("npm").arg("bundled");
cmd.arg("pin")
.arg("--to")
.arg("global")
.arg("npm")
.arg("bundled");
})
.success();

Expand All @@ -197,7 +205,11 @@ mod pin_global {

sandbox
.run_bin(|cmd| {
cmd.arg("pin").arg("--global").arg("npm").arg("1.2");
cmd.arg("pin")
.arg("--to")
.arg("global")
.arg("npm")
.arg("1.2");
})
.success();

Expand All @@ -221,7 +233,8 @@ mod pin_global {
sandbox
.run_bin(|cmd| {
cmd.arg("pin")
.arg("--global")
.arg("--to")
.arg("global")
.arg("npm")
.arg("6")
.arg("--resolve");
Expand All @@ -244,7 +257,11 @@ mod pin_global {

sandbox
.run_bin(|cmd| {
cmd.arg("pin").arg("--global").arg("node").arg("20");
cmd.arg("pin")
.arg("--to")
.arg("global")
.arg("node")
.arg("20");
})
.success();

Expand Down
3 changes: 2 additions & 1 deletion crates/cli/tests/plugin_add_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ mod plugin_add {
.arg("add")
.arg("id")
.arg("https://github.com/moonrepo/tools/releases/latest/download/example_plugin.wasm")
.arg("--global");
.arg("--to")
.arg("global");
})
.success();

Expand Down
6 changes: 5 additions & 1 deletion crates/cli/tests/plugin_remove_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ mod plugin_remove {

sandbox
.run_bin(|cmd| {
cmd.arg("plugin").arg("remove").arg("id").arg("--global");
cmd.arg("plugin")
.arg("remove")
.arg("id")
.arg("--from")
.arg("global");
})
.success();

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/plugin_search_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ mod plugin_search {
.failure();

assert.stderr(predicate::str::contains(
"No plugins available for query \"gibberish\"",
"no plugins found in the registry for the query gibberish",
));
}

Expand Down
14 changes: 4 additions & 10 deletions crates/cli/tests/run_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,7 @@ mod run {
})
.success();

assert.stdout(predicate::str::contains(
"Node.js 19.0.0 has been installed",
));
assert.stdout(predicate::str::contains("Node.js 19.0.0 installed"));
}

#[test]
Expand All @@ -211,9 +209,7 @@ mod run {
})
.success();

assert.stdout(predicate::str::contains(
"Node.js 19.0.0 has been installed",
));
assert.stdout(predicate::str::contains("Node.js 19.0.0 installed"));

env::remove_var("PROTO_AUTO_INSTALL");
}
Expand Down Expand Up @@ -251,9 +247,7 @@ mod run {
})
.success();

assert.stdout(predicate::str::contains(
"Node.js 19.0.0 has been installed",
));
assert.stdout(predicate::str::contains("Node.js 19.0.0 installed"));

let assert = sandbox
.run_bin(|cmd| {
Expand All @@ -265,7 +259,7 @@ mod run {
})
.success();

assert.stdout(predicate::str::contains("Node.js 19.0.0 has been installed").not());
assert.stdout(predicate::str::contains("Node.js 19.0.0 installed").not());
}

#[test]
Expand Down
3 changes: 2 additions & 1 deletion crates/cli/tests/unalias_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ mod unalias_global {
cmd.arg("unalias")
.arg("node")
.arg("example")
.arg("--global");
.arg("--from")
.arg("global");
})
.success();

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/uninstall_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mod uninstall {
cmd.arg("uninstall").arg("node").arg("19.0.0");
});

assert.inner.stderr(predicate::str::contains(
assert.inner.stdout(predicate::str::contains(
"Node.js 19.0.0 has not been installed locally",
));
}
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/unpin_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ mod unpin_global {

sandbox
.run_bin(|cmd| {
cmd.arg("unpin").arg("node").arg("--global");
cmd.arg("unpin").arg("node").arg("--from").arg("global");
})
.success();

Expand Down

0 comments on commit 4d643a0

Please sign in to comment.