Skip to content

Commit

Permalink
Optimized tests and full coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
juanhapes committed Mar 26, 2021
1 parent e5ce870 commit 1c5a907
Show file tree
Hide file tree
Showing 16 changed files with 586 additions and 130 deletions.
2 changes: 1 addition & 1 deletion lib/api-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { API } = require('@janiscommerce/api');

const { Invoker } = require('@janiscommerce/lambda');

const ClientFetcher = require('./helpers/client-model-fetcher');
const ClientFetcher = require('./helpers/model-fetcher');
const ModelFormatter = require('./helpers/model-formatter');

module.exports = class ClientCreateAPI extends API {
Expand Down
6 changes: 0 additions & 6 deletions lib/helpers/credentials-fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,13 @@ module.exports = class CredentialsFetcher {

static async fetch() {

if(this.secretValue)
return;

try {

console.log(this.secretName);

const secretHandler = AwsSecretsManager.secret(this.secretName);

this.secretValue = await secretHandler.getValue();

} catch(err) {
console.log(err);
this.secretValue = {};
// nothing to do here
// no explota en este punto así dejamos que algún Driver se conecte por contexto, sin credenciales
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/helpers/model-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const replaceKeys = require('./replace-keys');

const CredentialsFetcher = require('./credentials-fetcher');

const ClientFetcher = require('./client-model-fetcher');
const ClientFetcher = require('./model-fetcher');

module.exports = class ModelFormatter {

Expand Down
2 changes: 1 addition & 1 deletion lib/listener-created.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { EventListener } = require('@janiscommerce/event-listener');

const MongoDBIndexCreator = require('@janiscommerce/mongodb-index-creator');

const ClientFetcher = require('./helpers/client-model-fetcher');
const ClientFetcher = require('./helpers/model-fetcher');
const ModelFormatter = require('./helpers/model-formatter');

const mongoDBIndexCreator = new MongoDBIndexCreator();
Expand Down
4 changes: 2 additions & 2 deletions lib/listener-removed.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { EventListener } = require('@janiscommerce/event-listener');
const Model = require('@janiscommerce/model');

const ClientFetcher = require('./helpers/client-model-fetcher');
const ClientFetcher = require('./helpers/model-fetcher');

module.exports = class ClientRemovedListener extends EventListener {

Expand All @@ -13,7 +13,7 @@ module.exports = class ClientRemovedListener extends EventListener {

get model() {

if(this._model) {
if(!this._model) {
const ClientModel = ClientFetcher.get();
this._model = new ClientModel();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/listener-updated.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { EventListener } = require('@janiscommerce/event-listener');
const MicroserviceCall = require('@janiscommerce/microservice-call');

const ClientFetcher = require('./helpers/client-model-fetcher');
const ClientFetcher = require('./helpers/model-fetcher');

module.exports = class ClientUpdatedListener extends EventListener {

Expand Down
Loading

0 comments on commit 1c5a907

Please sign in to comment.