|
18 | 18 |
|
19 | 19 | import java.io.File; |
20 | 20 | import java.io.IOException; |
| 21 | +import java.net.MalformedURLException; |
21 | 22 | import java.nio.charset.StandardCharsets; |
22 | 23 | import java.util.ArrayList; |
23 | 24 | import java.util.Arrays; |
| 25 | +import java.util.Collections; |
24 | 26 | import java.util.HashMap; |
25 | 27 | import java.util.LinkedHashMap; |
26 | 28 | import java.util.LinkedHashSet; |
|
31 | 33 | import org.apache.commons.io.FileUtils; |
32 | 34 | import org.junit.Assert; |
33 | 35 | import org.junit.Before; |
34 | | -import org.junit.Ignore; |
35 | 36 | import org.junit.Rule; |
36 | 37 | import org.junit.Test; |
37 | 38 | import org.junit.rules.ExpectedException; |
@@ -219,17 +220,15 @@ public void npmIsInUse_platformVersionsJsonAdded_versionsPinned() |
219 | 220 | } |
220 | 221 |
|
221 | 222 | @Test |
222 | | - @Ignore |
223 | | - public void npmIsInUse_switchToPnpm_pinnedVersionsDeleted() |
| 223 | + public void pnpmIsInUse_platformVersionsJsonAdded_dependenciesAdded() |
224 | 224 | throws IOException { |
225 | | - runTestWithoutPreexistingPackageJson(); |
226 | | - final TaskUpdatePackages task = createTask( |
227 | | - createApplicationDependencies(), true); |
228 | | - task.execute(); |
229 | | - Assert.assertTrue("Updates not picked", task.modified); |
| 225 | + verifyPlatformDependenciesAreAdded(true); |
| 226 | + } |
230 | 227 |
|
231 | | - // only the application dependency should stay |
232 | | - verifyVersions(PLATFORM_DIALOG_VERSION, null, null); |
| 228 | + @Test |
| 229 | + public void npmIsInUse_platformVersionsJsonAdded_dependenciesAdded() |
| 230 | + throws IOException { |
| 231 | + verifyPlatformDependenciesAreAdded(false); |
233 | 232 | } |
234 | 233 |
|
235 | 234 | @Test |
@@ -569,4 +568,23 @@ private void verifyVersionLockingWithNpmOverrides(boolean hasDialogLocking, |
569 | 568 | } |
570 | 569 | } |
571 | 570 |
|
| 571 | + private void verifyPlatformDependenciesAreAdded(boolean enablePnpm) |
| 572 | + throws MalformedURLException, IOException { |
| 573 | + Mockito.when(finder.getResource(Constants.VAADIN_VERSIONS_JSON)) |
| 574 | + .thenReturn(versionJsonFile.toURI().toURL()); |
| 575 | + final String newVersion = "20.0.0"; |
| 576 | + createVaadinVersionsJson(newVersion, newVersion, newVersion); |
| 577 | + |
| 578 | + final Map<String, String> applicationDependencies = Collections |
| 579 | + .emptyMap(); |
| 580 | + final TaskUpdatePackages task = createTask(applicationDependencies, |
| 581 | + enablePnpm); |
| 582 | + |
| 583 | + verifyVersions(null, null, null); |
| 584 | + |
| 585 | + task.execute(); |
| 586 | + |
| 587 | + verifyVersions(newVersion, newVersion, newVersion); |
| 588 | + } |
| 589 | + |
572 | 590 | } |
0 commit comments