Skip to content

Commit

Permalink
[INTERNAL] ApplicationBuilder: Add test for projects without namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomByte committed Jan 21, 2019
1 parent a83b034 commit 83028b5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/types/application/ApplicationBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const tasks = { // can't require index.js due to circular dependency
class ApplicationBuilder extends AbstractBuilder {
addStandardTasks({resourceCollections, project, log}) {
if (!project.metadata.namespace) {
log.info("Skipping some tasks due to missing application namespace information. If your project contains" +
log.info("Skipping some tasks due to missing application namespace information. If your project contains " +
"a Component.js, you might be missing a manifest.json file. " +
"Also see: https://github.com/SAP/ui5-builder#application");
}
Expand Down
2 changes: 1 addition & 1 deletion lib/types/application/ApplicationFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ApplicationFormatter extends AbstractFormatter {

return this.readManifest(project).then(function(manifest) {
if (!manifest["sap.app"] || !manifest["sap.app"].id) {
log.warn(`No "sap.app" ID configuration found in manifest of project ${project.metadata.name}`, );
log.warn(`No "sap.app" ID configuration found in manifest of project ${project.metadata.name}`);
return;
}
project.metadata.namespace = manifest["sap.app"].id.replace(/\./g, "/");
Expand Down
22 changes: 21 additions & 1 deletion test/lib/types/application/ApplicationBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ test("Instantiation", (t) => {
], "ApplicationBuilder is instantiated with standard tasks");
});

test("Instantiation without component preload", (t) => {
test("Instantiation without component preload project configuration", (t) => {
const project = clone(applicationBTree);
project.builder.componentPreload = undefined;
const appBuilder = new ApplicationBuilder({parentLogger, project});
Expand All @@ -91,6 +91,26 @@ test("Instantiation without component preload", (t) => {
], "ApplicationBuilder is still instantiated with standard tasks");
});

test("Instantiation without project namespace", (t) => {
const project = clone(applicationBTree);
project.builder.componentPreload = undefined;
project.metadata.namespace = undefined;
const appBuilder = new ApplicationBuilder({parentLogger, project});
t.truthy(appBuilder);
t.deepEqual(appBuilder.taskExecutionOrder, [
"replaceCopyright",
"replaceVersion",
"generateFlexChangesBundle",
"generateManifestBundle",
"generateStandaloneAppBundle",
"transformBootstrapHtml",
"generateBundle",
"createDebugFiles",
"uglify",
"generateVersionInfo"
], "All standard tasks but generateComponentPreload will be executed");
});

test("Instantiation with custom tasks", (t) => {
const project = clone(applicationBTree);
project.builder.customTasks = [
Expand Down

0 comments on commit 83028b5

Please sign in to comment.