Skip to content

Commit

Permalink
Merge pull request #49 from Psychopoulet/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Psychopoulet committed Oct 29, 2020
2 parents a581c40 + 9e8d424 commit 63bb849
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
12 changes: 12 additions & 0 deletions lib/components/DescriptorUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ module.exports = class DescriptorUser extends Events {

// public

getPluginName () {
return this._Descriptor && this._Descriptor.info && this._Descriptor.info.title ? this._Descriptor.info.title : "";
}

getPluginVersion () {
return this._Descriptor && this._Descriptor.info && this._Descriptor.info.version ? this._Descriptor.info.version : "";
}

getPluginDescription () {
return this._Descriptor && this._Descriptor.info && this._Descriptor.info.description ? this._Descriptor.info.description : "";
}

// must be inherited
init () {

Expand Down
4 changes: 4 additions & 0 deletions lib/components/Orchestrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ module.exports = class Orchestrator extends MediatorUser {

// protected

this._Descriptor = null;

this._Mediator = null;

this._Server = null;
this._socketServer = null; // to delay socketMiddleware if necessary
this._checkParameters = true; // to delay checkParameters if necessary
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-pluginsmanager-plugin",
"version": "4.2.7",
"version": "4.3.0",
"description": "An abstract parent plugin for node-pluginsmanager",
"main": "lib/main.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -35,20 +35,20 @@
"url": "https://github.com/Psychopoulet/node-pluginsmanager-plugin/issues"
},
"dependencies": {
"@apidevtools/swagger-parser": "10.0.1",
"@apidevtools/swagger-parser": "10.0.2",
"express-openapi-validate": "0.5.1"
},
"devDependencies": {
"@types/node": "14.6.3",
"@types/ws": "7.2.6",
"@types/node": "14.14.6",
"@types/ws": "7.2.9",
"@types/socket.io": "2.1.11",
"check-version-modules": "1.3.0",
"coveralls": "3.1.0",
"colors": "1.4.0",
"eslint": "7.8.1",
"eslint": "7.12.1",
"express": "4.17.1",
"husky": "4.2.5",
"mocha": "8.1.3",
"husky": "4.3.0",
"mocha": "8.2.0",
"nyc": "15.1.0",
"socket.io": "2.3.0",
"ws": "7.3.1"
Expand Down
18 changes: 18 additions & 0 deletions test/3_DescriptorUser_3_checkDescriptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,24 @@ describe("DescriptorUser / checkDescriptor", () => {

});

it("should check accessors", () => {

const du = new LocalDescriptorUser({
"descriptor": {
"info": {
"title": "test",
"version": "1.7.0",
"description": "This is a test"
}
}
});

strictEqual(du.getPluginName(), "test", "name accessor does not work");
strictEqual(du.getPluginVersion(), "1.7.0", "version accessor does not work");
strictEqual(du.getPluginDescription(), "This is a test", "description accessor does not work");

});

describe("title", () => {

it("should check with missing Descriptor info title", (done) => {
Expand Down
2 changes: 1 addition & 1 deletion test/utils/DescriptorUser/Descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.2",
"info": {
"title": "node-pluginsmanager-plugin",
"version": "4.2.7",
"version": "4.3.0",
"description": "An abstract parent plugin for node-pluginsmanager",
"contact": {
"name": "Sébastien VIDAL",
Expand Down

0 comments on commit 63bb849

Please sign in to comment.