Skip to content

Commit

Permalink
Merge pull request #2 from janis-commerce/JAN-734-main-call-from-pack…
Browse files Browse the repository at this point in the history
…age.json

JAN-734-main-call-from-package.json
  • Loading branch information
jormaechea committed Oct 4, 2019
2 parents 438e941 + 20ef95d commit 932eb83
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 27 deletions.
5 changes: 0 additions & 5 deletions index.js

This file was deleted.

3 changes: 2 additions & 1 deletion lib/event-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const EventParserError = require('./event-parser-error');

const ModelEvent = require('./model-event');

const modelEvent = new ModelEvent();

class EventParser {
/**
* Get the event actions
Expand All @@ -21,7 +23,6 @@ class EventParser {
if(!entity || !event)
throw new EventParserError('Message entity and event are required', EventParserError.codes.INVALID_DATA);

const modelEvent = new ModelEvent();
const { subscribers } = await modelEvent.getEvent(client, entity, event);

return subscribers && Array.isArray(subscribers) ? subscribers : [];
Expand Down
9 changes: 0 additions & 9 deletions lib/index.js

This file was deleted.

6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"name": "@janiscommerce/event-parser",
"version": "1.0.0",
"description": "",
"main": "index.js",
"main": "lib/event-parser.js",
"scripts": {
"test": "export TEST_ENV=true; mocha --exit -R nyan --recursive tests/",
"test-ci": "nyc --reporter=html --reporter=text mocha --recursive tests/",
"watch-test": "export TEST_ENV=true; mocha --exit -R nyan -w --recursive tests/",
"coverage": "nyc npm test",
"lint": "eslint index.js lib/ tests/"
"lint": "eslint lib/ tests/"
},
"repository": {
"type": "git",
Expand Down
8 changes: 2 additions & 6 deletions tests/event-parser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const assert = require('assert');

const sandbox = require('sinon').createSandbox();

const Package = require('../index');
const EventParser = require('../lib/event-parser');

const { EventParser, ModelEvent } = require('../lib');
const ModelEvent = require('../lib/model-event');

describe('EventParser', () => {
const message = {
Expand All @@ -26,10 +26,6 @@ describe('EventParser', () => {
sandbox.restore();
});

it('Should return and instance of event parser', () => {
assert.deepStrictEqual(Package, EventParser);
});

it('Should throw error when not receive message', async () => {
await assert.rejects(EventParser.getSubscribers(), {
name: 'EventParserError',
Expand Down
2 changes: 1 addition & 1 deletion tests/model-event-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Settings = require('@janiscommerce/settings');

const sandbox = require('sinon').createSandbox();

const { ModelEvent } = require('../lib');
const ModelEvent = require('../lib/model-event');

const modelEvent = new ModelEvent();

Expand Down

0 comments on commit 932eb83

Please sign in to comment.