Skip to content

Commit 865d4b2

Browse files
committed
add higher level test
1 parent a6a52eb commit 865d4b2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

rs_lib/src/local.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,29 @@ mod test {
12721272
));
12731273
}
12741274

1275+
#[test]
1276+
fn test_copy_version_metadata_file() {
1277+
let test_caches = TestCaches::new();
1278+
let metadata_url =
1279+
Url::parse("https://jsr.io/@david/dax/1.2.3_meta.json").unwrap();
1280+
let data =
1281+
r#"{ "moduleGraph2": "testing", "checksums": { "test": "test" } }"#;
1282+
test_caches
1283+
.global_cache
1284+
.set(&metadata_url, Default::default(), data.as_bytes())
1285+
.unwrap();
1286+
let key = test_caches
1287+
.local_cache
1288+
.cache_item_key(&metadata_url)
1289+
.unwrap();
1290+
let final_data = test_caches.local_cache.get(&key, None).unwrap().unwrap();
1291+
assert_eq!(
1292+
String::from_utf8(final_data.content.to_vec()).unwrap(),
1293+
// had the moduleGraph2 property stripped
1294+
r#"{"checksums":{"test":"test"}}"#
1295+
);
1296+
}
1297+
12751298
#[test]
12761299
fn test_is_jsr_version_metadata_url() {
12771300
let cases = [

0 commit comments

Comments
 (0)