summaryrefslogtreecommitdiff
path: root/tests/integration/jsr_tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/jsr_tests.rs')
-rw-r--r--tests/integration/jsr_tests.rs26
1 files changed, 15 insertions, 11 deletions
diff --git a/tests/integration/jsr_tests.rs b/tests/integration/jsr_tests.rs
index f31b53f27..af5b24fe4 100644
--- a/tests/integration/jsr_tests.rs
+++ b/tests/integration/jsr_tests.rs
@@ -6,6 +6,8 @@ use deno_core::serde_json::json;
use deno_core::serde_json::Value;
use deno_lockfile::Lockfile;
use deno_lockfile::NewLockfileOptions;
+use deno_semver::jsr::JsrDepPackageReq;
+use deno_semver::package::PackageNv;
use test_util as util;
use url::Url;
use util::assert_contains;
@@ -154,8 +156,10 @@ console.log(version);"#,
.content
.packages
.specifiers
- .get_mut("jsr:@denotest/no-module-graph@0.1")
- .unwrap() = "jsr:@denotest/no-module-graph@0.1.0".to_string();
+ .get_mut(
+ &JsrDepPackageReq::from_str("jsr:@denotest/no-module-graph@0.1").unwrap(),
+ )
+ .unwrap() = "0.1.0".to_string();
lockfile_path.write(lockfile.as_json_string());
test_context
@@ -276,9 +280,9 @@ console.log(version);"#,
overwrite: false,
})
.unwrap();
- let pkg_name = "@denotest/no-module-graph@0.1.1";
- let original_integrity = get_lockfile_pkg_integrity(&lockfile, pkg_name);
- set_lockfile_pkg_integrity(&mut lockfile, pkg_name, "bad_integrity");
+ let pkg_nv = "@denotest/no-module-graph@0.1.1";
+ let original_integrity = get_lockfile_pkg_integrity(&lockfile, pkg_nv);
+ set_lockfile_pkg_integrity(&mut lockfile, pkg_nv, "bad_integrity");
lockfile_path.write(lockfile.as_json_string());
let actual_integrity =
@@ -317,7 +321,7 @@ Investigate the lockfile; delete it to regenerate the lockfile or --reload to re
.assert_exit_code(10);
// now update to the correct integrity
- set_lockfile_pkg_integrity(&mut lockfile, pkg_name, &original_integrity);
+ set_lockfile_pkg_integrity(&mut lockfile, pkg_nv, &original_integrity);
lockfile_path.write(lockfile.as_json_string());
// should pass now
@@ -329,7 +333,7 @@ Investigate the lockfile; delete it to regenerate the lockfile or --reload to re
.assert_exit_code(0);
// now update to a bad integrity again
- set_lockfile_pkg_integrity(&mut lockfile, pkg_name, "bad_integrity");
+ set_lockfile_pkg_integrity(&mut lockfile, pkg_nv, "bad_integrity");
lockfile_path.write(lockfile.as_json_string());
// shouldn't matter because we have a vendor folder
@@ -400,12 +404,12 @@ If you modified your global cache, run again with the --reload flag to restore i
.assert_exit_code(10);
}
-fn get_lockfile_pkg_integrity(lockfile: &Lockfile, pkg_name: &str) -> String {
+fn get_lockfile_pkg_integrity(lockfile: &Lockfile, pkg_nv: &str) -> String {
lockfile
.content
.packages
.jsr
- .get(pkg_name)
+ .get(&PackageNv::from_str(pkg_nv).unwrap())
.unwrap()
.integrity
.clone()
@@ -413,14 +417,14 @@ fn get_lockfile_pkg_integrity(lockfile: &Lockfile, pkg_name: &str) -> String {
fn set_lockfile_pkg_integrity(
lockfile: &mut Lockfile,
- pkg_name: &str,
+ pkg_nv: &str,
integrity: &str,
) {
lockfile
.content
.packages
.jsr
- .get_mut(pkg_name)
+ .get_mut(&PackageNv::from_str(pkg_nv).unwrap())
.unwrap()
.integrity = integrity.to_string();
}