-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
476b785
commit 93c9b39
Showing
9 changed files
with
297 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
test/fixtures/legacy.library.a/node_modules/library.f/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
test/fixtures/legacy.library.a/node_modules/library.f/ui5.yaml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "legacy.library.a", | ||
"version": "1.0.0", | ||
"description": "Simple SAPUI5 based library - legacy library missing ui5.yaml", | ||
"devDependencies": { | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
test/fixtures/legacy.library.a/src/legacy/library/a/.library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<library xmlns="http://www.sap.com/sap.ui.library.xsd" > | ||
|
||
<name>legacy.library.a</name> | ||
<vendor>SAP SE</vendor> | ||
<copyright>${copyright}</copyright> | ||
<version>${version}</version> | ||
|
||
<documentation>Legacy Library A</documentation> | ||
|
||
</library> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/*! | ||
* ${copyright} | ||
*/ | ||
console.log('HelloWorld'); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
const {test} = require("ava"); | ||
const path = require("path"); | ||
const projectPreprocessor = require("../..").projectPreprocessor; | ||
const applicationAPath = path.join(__dirname, "..", "fixtures", "application.a"); | ||
const legacyLibraryAPath = path.join(__dirname, "..", "fixtures", "legacy.library.a"); | ||
|
||
test("Projects with extension dependency inline configuration", (t) => { | ||
const tree = { | ||
id: "application.a", | ||
path: applicationAPath, | ||
dependencies: [{ | ||
id: "extension.a", | ||
path: applicationAPath, | ||
dependencies: [], | ||
version: "1.0.0", | ||
specVersion: "0.1", | ||
kind: "extension", | ||
type: "project-shim", | ||
metadata: { | ||
name: "shims.a" | ||
}, | ||
configurations: { | ||
"legacy.library.a": { | ||
specVersion: "0.1", | ||
type: "library", | ||
metadata: { | ||
name: "legacy.library.a", | ||
} | ||
} | ||
} | ||
}, { | ||
id: "legacy.library.a", | ||
version: "1.0.0", | ||
path: legacyLibraryAPath, | ||
dependencies: [] | ||
}], | ||
version: "1.0.0", | ||
specVersion: "0.1", | ||
type: "application", | ||
metadata: { | ||
name: "xy" | ||
} | ||
}; | ||
return projectPreprocessor.processTree(tree).then((parsedTree) => { | ||
t.deepEqual(parsedTree, { | ||
_level: 0, | ||
type: "application", | ||
metadata: { | ||
name: "xy", | ||
}, | ||
resources: { | ||
configuration: { | ||
paths: { | ||
webapp: "webapp" | ||
} | ||
}, | ||
pathMappings: { | ||
"/": "webapp", | ||
} | ||
}, | ||
dependencies: [{ | ||
id: "legacy.library.a", | ||
kind: "project", | ||
version: "1.0.0", | ||
specVersion: "0.1", | ||
path: legacyLibraryAPath, | ||
_level: 1, | ||
type: "library", | ||
metadata: { | ||
name: "legacy.library.a", | ||
copyright: "${copyright}", | ||
}, | ||
resources: { | ||
configuration: { | ||
paths: { | ||
src: "src", | ||
test: "test" | ||
} | ||
}, | ||
pathMappings: { | ||
"/resources/": "src", | ||
"/test-resources/": "test" | ||
} | ||
}, | ||
dependencies: [] | ||
}], | ||
id: "application.a", | ||
kind: "project", | ||
version: "1.0.0", | ||
specVersion: "0.1", | ||
path: applicationAPath | ||
}, "Parsed correctly"); | ||
}); | ||
}); | ||
|
||
test("Projects with extension dependency inline configuration", (t) => { | ||
const tree = { | ||
id: "application.a", | ||
path: applicationAPath, | ||
dependencies: [{ | ||
id: "extension.a", | ||
path: applicationAPath, | ||
dependencies: [], | ||
version: "1.0.0", | ||
specVersion: "0.1", | ||
kind: "extension", | ||
type: "project-type", | ||
metadata: { | ||
name: "z" | ||
} | ||
}], | ||
version: "1.0.0", | ||
specVersion: "0.1", | ||
type: "z", | ||
metadata: { | ||
name: "xy" | ||
} | ||
}; | ||
return t.throws(projectPreprocessor.processTree(tree).then((parsedTree) => { | ||
t.deepEqual(parsedTree, { | ||
_level: 0, | ||
type: "z", | ||
metadata: { | ||
name: "xy", | ||
}, | ||
resources: { | ||
configuration: { | ||
paths: { | ||
root: "" | ||
} | ||
}, | ||
pathMappings: { | ||
"/": "", | ||
} | ||
}, | ||
dependencies: [], | ||
id: "application.a", | ||
kind: "project", | ||
version: "1.0.0", | ||
specVersion: "0.1", | ||
path: applicationAPath | ||
}, "Parsed correctly"); | ||
}), "Unknown extension type 'project-type' for extension.a", "Rejected with error"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters