Search in sources :

Example 11 with FrontendDependencies

use of com.vaadin.flow.server.frontend.scanner.FrontendDependencies in project flow by vaadin.

the class AbstractNodeUpdatePackagesTest method generatePackageJson_addedDependencies_updaterIsModified.

@Test
public void generatePackageJson_addedDependencies_updaterIsModified() {
    FrontendDependencies frontendDependencies = Mockito.mock(FrontendDependencies.class);
    Map<String, String> packages = new HashMap<>();
    packages.put("@polymer/iron-list", "3.0.2");
    packages.put("@vaadin/vaadin-confirm-dialog", "1.1.4");
    packages.put("@vaadin/vaadin-checkbox", "2.2.10");
    packages.put("@polymer/iron-icon", "3.0.1");
    packages.put("@vaadin/vaadin-time-picker", "2.0.2");
    Mockito.when(frontendDependencies.getPackages()).thenReturn(packages);
    packageUpdater = new TaskUpdatePackages(classFinder, frontendDependencies, baseDir, generatedDir, resourcesDir, false, false, TARGET, featureFlags);
    packageCreator.execute();
    packageUpdater.execute();
    packages.put("@vaadin/vaadin-list-box", "1.1.1");
    packageUpdater.execute();
    Assert.assertTrue("Modification flag should be true when dependency added.", packageUpdater.modified);
}
Also used : HashMap(java.util.HashMap) FrontendDependencies(com.vaadin.flow.server.frontend.scanner.FrontendDependencies) Test(org.junit.Test)

Example 12 with FrontendDependencies

use of com.vaadin.flow.server.frontend.scanner.FrontendDependencies in project flow by vaadin.

the class TaskUpdatePackagesNpmTest method createTask.

private TaskUpdatePackages createTask(Map<String, String> applicationDependencies, boolean enablePnpm) {
    final FrontendDependencies frontendDependenciesScanner = Mockito.mock(FrontendDependencies.class);
    Mockito.when(frontendDependenciesScanner.getPackages()).thenReturn(applicationDependencies);
    return new TaskUpdatePackages(finder, frontendDependenciesScanner, npmFolder, generatedPath, null, false, enablePnpm, TARGET, Mockito.mock(FeatureFlags.class)) {
    };
}
Also used : FeatureFlags(com.vaadin.experimental.FeatureFlags) FrontendDependencies(com.vaadin.flow.server.frontend.scanner.FrontendDependencies)

Aggregations

FrontendDependencies (com.vaadin.flow.server.frontend.scanner.FrontendDependencies)12 Test (org.junit.Test)11 HashMap (java.util.HashMap)10 JsonObject (elemental.json.JsonObject)4 FeatureFlags (com.vaadin.experimental.FeatureFlags)2 TARGET (com.vaadin.flow.server.Constants.TARGET)1 DEFAULT_FRONTEND_DIR (com.vaadin.flow.server.frontend.FrontendUtils.DEFAULT_FRONTEND_DIR)1 DEFAULT_GENERATED_DIR (com.vaadin.flow.server.frontend.FrontendUtils.DEFAULT_GENERATED_DIR)1 IMPORTS_NAME (com.vaadin.flow.server.frontend.FrontendUtils.IMPORTS_NAME)1 NODE_MODULES (com.vaadin.flow.server.frontend.FrontendUtils.NODE_MODULES)1 ClassFinder (com.vaadin.flow.server.frontend.scanner.ClassFinder)1 AbstractTheme (com.vaadin.flow.theme.AbstractTheme)1 ThemeDefinition (com.vaadin.flow.theme.ThemeDefinition)1 File (java.io.File)1 IOException (java.io.IOException)1 Charset (java.nio.charset.Charset)1 Files (java.nio.file.Files)1 Paths (java.nio.file.Paths)1 Collections (java.util.Collections)1 List (java.util.List)1