Skip to content

Commit

Permalink
[INTERNAL] Update JSDoc / tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matz3 committed Mar 30, 2023
1 parent c6e4c9f commit 2fb9cb9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/ui5Framework/AbstractResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,20 @@ const VERSION_RANGE_REGEXP = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
* @hideconstructor
*/
class AbstractResolver {
/* eslint-disable max-len */
/**
* @param {*} options options
* @param {string} [options.version] Framework version to use.
* @param {string} [options.version] Framework version to use. When omitted, all libraries need to be available
* via <code>providedLibraryMetadata</code> parameter. Otherwise an error is thrown.
* @param {string} [options.cwd=process.cwd()] Working directory to resolve configurations like .npmrc
* @param {string} [options.ui5HomeDir="~/.ui5"] UI5 home directory location. This will be used to store packages,
* metadata and configuration used by the resolvers. Relative to `process.cwd()`
* @param {string} [options.providedLibraryMetadata] TODO
* @param {object.<string, @ui5/project/ui5Framework/AbstractResolver~LibraryMetadataEntry>} [options.providedLibraryMetadata]
* Resolver skips installing listed libraries and uses the dependency information to resolve their dependencies.
* <code>version</code> can be omitted in case all libraries can be resolved via the <code>providedLibraryMetadata</code>.
* Otherwise an error is thrown.
*/
/* eslint-enable max-len */
constructor({cwd, version, ui5HomeDir, providedLibraryMetadata}) {
if (new.target === AbstractResolver) {
throw new TypeError("Class 'AbstractResolver' is abstract");
Expand Down Expand Up @@ -157,7 +163,6 @@ class AbstractResolver {
* Object containing all installed libraries with library name as key
*/

/* eslint-enable max-len */
/**
* Installs the provided libraries and their dependencies
*
Expand Down
9 changes: 9 additions & 0 deletions test/lib/ui5framework/AbstractResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ test("AbstractResolver: constructor", (t) => {
});
t.true(resolver instanceof MyResolver, "Constructor returns instance of sub-class");
t.true(resolver instanceof AbstractResolver, "Constructor returns instance of abstract class");
t.is(resolver._version, "1.75.0");
});

test("AbstractResolver: constructor without version", (t) => {
const {MyResolver} = t.context;
const resolver = new MyResolver({
cwd: "/test-project/"
});
t.is(resolver._version, undefined);
});

test("AbstractResolver: Set absolute 'cwd'", (t) => {
Expand Down

0 comments on commit 2fb9cb9

Please sign in to comment.