Skip to content

Commit 7a4ac80

Browse files
committed
test(update): try to reproduce issue #303
1 parent e385739 commit 7a4ac80

1 file changed

Lines changed: 47 additions & 1 deletion

File tree

src/visit_packages/preferred_semver_test.rs

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1679,6 +1679,52 @@ mod registry_updates {
16791679
]);
16801680
}
16811681

1682+
#[tokio::test]
1683+
async fn reports_two_minor_exact_semver_updates_in_one_file() {
1684+
let ctx = TestBuilder::new()
1685+
.with_package(json!({
1686+
"name": "package-a",
1687+
"dependencies": {
1688+
"wat": "1.0.1"
1689+
},
1690+
"devDependencies": {
1691+
"wat": "2.0.0"
1692+
}
1693+
}))
1694+
.with_update_target(UpdateTarget::Minor)
1695+
.with_registry_updates(json!({
1696+
"wat": ["1.0.1", "1.0.2", "1.1.2", "1.3.3", "2.0.0", "2.2.2"],
1697+
}))
1698+
.build_with_registry_and_visit()
1699+
.await;
1700+
expect(&ctx).to_have_instances(vec![
1701+
ExpectedInstance {
1702+
state: InstanceState::suspect(InvalidLocalVersion),
1703+
dependency_name: "package-a",
1704+
id: "package-a in /version of package-a",
1705+
actual: "",
1706+
expected: Some(""),
1707+
overridden: None,
1708+
},
1709+
ExpectedInstance {
1710+
state: InstanceState::fixable(DiffersToNpmRegistry),
1711+
dependency_name: "wat",
1712+
id: "wat in /dependencies of package-a",
1713+
actual: "1.0.1",
1714+
expected: Some("1.3.3"),
1715+
overridden: None,
1716+
},
1717+
ExpectedInstance {
1718+
state: InstanceState::fixable(DiffersToNpmRegistry),
1719+
dependency_name: "wat",
1720+
id: "wat in /devDependencies of package-a",
1721+
actual: "2.0.0",
1722+
expected: Some("2.2.2"),
1723+
overridden: None,
1724+
},
1725+
]);
1726+
}
1727+
16821728
#[tokio::test]
16831729
async fn reports_one_minor_update_with_loose_semver_range_in_one_file() {
16841730
let ctx = TestBuilder::new()
@@ -1793,7 +1839,7 @@ mod registry_updates {
17931839
}
17941840

17951841
#[tokio::test]
1796-
async fn reports_two_minor_exact_semver_updates_in_one_file() {
1842+
async fn reports_two_patch_exact_semver_updates_in_one_file() {
17971843
let ctx = TestBuilder::new()
17981844
.with_package(json!({
17991845
"name": "package-a",

0 commit comments

Comments
 (0)