Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

harcon

Package Overview
Dependencies
Maintainers
1
Versions
326
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

harcon - npm Package Compare versions

Comparing version 1.3.14 to 1.4.0

test/components/Alizee.js

3

lib/Firestarter.js

@@ -10,5 +10,4 @@ var Communication = require('./Communication');

var toString = Object.prototype.toString;
function isString(obj) {
return toString.call(obj) === "[object String]";
return Object.prototype.toString.call(obj) === "[object String]";
}

@@ -15,0 +14,0 @@

@@ -71,23 +71,18 @@ var Firestarter = require('./Firestarter');

firestorm.matches = function( division, eventName ){
if( !this.sameDivision( division ) ) return false;
if( !eventName || !this.sameDivision( division ) ) return false;
var matches = true;
var index = eventName.lastIndexOf( '.' );
var prefix = eventName.substring(0, index);
var fnName = eventName.substring(index+1);
if( this.name !== prefix ){
var eventPath = index === -1 ? [] : prefix.split( '.' );
for(var i = 0, len = eventPath.length; i < len && i < this.pathLength; i+=1)
if( eventPath[i] === '*' ){
if( i === eventPath.length-1 ) break;
else continue;
var matches = fnName && this.events.contains( fnName );
if( matches && this.name !== prefix ){
var eventPath = index === -1 ? [] : prefix.split( '.' ), len = eventPath.length;
for(var i = 0; i < len && i < this.pathLength; i+=1)
if( this.path[i] !== eventPath[i] ){
matches = false; break;
}
else if( this.path[i] !== eventPath[i] ) matches = false;
else if( i === eventPath.length-1 && i<this.path.length-1 ) matches = false;
}
if( matches )
matches = this.events.contains(eventName.substring(index+1) );
this.logger.harconlog( null, 'Matching', {events: this.events, eventName: eventName, matches: matches}, 'silly' );

@@ -94,0 +89,0 @@

@@ -8,3 +8,3 @@ var Communication = require('../lib/Communication');

var VERSION = exports.VERSION = '1.3.14';
var VERSION = exports.VERSION = '1.4.0';

@@ -67,3 +67,4 @@ var _ = require('lodash');

this.division = '';
this.division = this.options.division || '';
this.divisionDeviation = !!this.options.divisionDeviation;

@@ -107,2 +108,3 @@ var self = this;

division: self.division,
divisionDeviation: self.divisionDeviation,
context: self.context,

@@ -180,2 +182,7 @@ detracts: self.detracts,

if( !object.division )
object.division = self.division;
if( object.division !== self.division && !self.divisionDeviation )
return this.logger.error( new Error('Object violates division deviation rule.'), object.name );
object.inflicterContext = this.inflicterContext;

@@ -182,0 +189,0 @@ var fss = new this.Firestormstarter( this.options, this.barrel, object, this.logger );

{
"name": "harcon",
"version": "1.3.14",
"version": "1.4.0",
"description": "Messaging/Service Bus for the harmonic convergence of node-based enterprise entities.",

@@ -49,3 +49,3 @@ "keywords": [

},
"_id": "harcon@1.3.14"
"_id": "harcon@1.4.0"
}

@@ -8,4 +8,4 @@ Harcon - Proven and reliable microservice solution for the harmonic convergence of JS entities.

========
[harcon](https://github.com/imrefazekas/harcon) is a service bus for NodeJS/Browser giving superior abstraction layer for interoperability between entities in a highly structured and fragmented ecosystem.
It allows you to design and implement complex workflows where context and causality of messages are important.
[harcon](https://github.com/imrefazekas/harcon) is a microservice solution for NodeJS/Browser giving superior abstraction layer for interoperability between entities in a highly structured and fragmented ecosystem.
It allows you to design and implement complex workflows and microservices where context and causality of messages are important.

@@ -16,2 +16,3 @@ The library has a stunning feature list beyond basic messaging functionality.

For zeromq integration, please check this: [harcon-zero](https://github.com/imrefazekas/harcon-zero)
For amqp integration, please check this: [harcon-amqp](https://github.com/imrefazekas/harcon-amqp)

@@ -46,7 +47,7 @@ - __Tracking__: you can monitor every message delivered (request or response) by only few lines of code

```javascript
var Inflicter = require('Inflicter');
var inflicter = new Inflicter( );
var Harcon = require('harcon');
var harcon = new Harcon( );
// define a listener function listening every message related to "greet" like "greet.goodmorning" or "greet.goodday"
inflicter.addict( null, 'peter', 'greet.*', function(greetings1, greetings2, callback){
harcon.addict( null, 'peter', 'greet.*', function(greetings1, greetings2, callback){
callback(null, 'Hi there!');

@@ -63,7 +64,7 @@ } );

};
inflicter.addicts( marie );
harcon.addicts( marie );
// sends a communication 'greet.everyone' with parameters and defines a callback to handle responses
// will receive back 2 answers: 'Hi there!' and 'Bonjour!'
inflicter.simpleIgnite( 'greet.everyone', 'Whatsup?', 'How do you do?', function(err, res){
harcon.simpleIgnite( 'greet.everyone', 'Whatsup?', 'How do you do?', function(err, res){
console.log( err, res );

@@ -74,2 +75,3 @@ } );

## Workflows

@@ -79,20 +81,14 @@

I take the liberty to define the workflow now as well defined routes and causality of messages.
Simple method calls do the same, you can say. Yes and no.
In a workflow, you are not dependent on the response timeframe, workflows manage distance in time and space. The recepient of a message can be on another server or city or planet. Recepient can answer right away or tomorrow or never.
Let me show a very short example:
You are a company providing VPN services to customers.
Orders taken by agents go to some accounting and client management subsystem and eventually your subsystem dealing with the technical setup receives a request through an interface of yours.
Next step is to identify the network the user will be connected to, so a message is sent to the networking department who will respond maybe a day later. When it does, you have to continue your workflow where it is stopped, so you try to allocate network resources there and if it is successful you create a network configuration firmware to be used on the client's router to communicate with your backbone. When it is done by a config creator submodule of yours, you send it to an operation department for testing and when it is done you send back the results to the accounting for validation.
And of course everything must be traceable and reconstructable and maybe rollable backwards.
This is an extremely simplified use case, in real-life, workflows are much more complicated things and even harder to handle properly.
In the JS world, one should mind the introduction of [microservices](http://martinfowler.com/articles/microservices.html) to start with right in the beginning. Just take the advantage of better orchestration, simpler development and debugging, easier deployment, scaling and monitoring.
[harcon](https://github.com/imrefazekas/harcon) is not a workflow designer tool, __"just"__ a low-level library to manage such processes. You define entities and the communications among them then publish them.
You can resurrect a workflow if it failed and continue where it failed.
You have to understand some details to use this lib at full scale.
[harcon](https://github.com/imrefazekas/harcon) is __"just"__ a low-level library to leverage such concept.
_In a simple way, you define entities and the communications among them then publish them._
#### Entities
In [harcon](https://github.com/imrefazekas/harcon), the communication unit is called simple entity.
In [harcon](https://github.com/imrefazekas/harcon), the communication unit is simply called __entity__.
One can define 2 type of entities:

@@ -102,18 +98,18 @@ - simple function: when you associate a function with an event-pattern. Recommended to be used as observer, job-like, surveillance-, or interface-related asset.

// Qualified name - will answer to only this message
inflicter.addict( null, 'hugh', 'allocate.ip', function(callback){
harcon.addict( null, 'hugh', 'allocate.ip', function(callback){
callback(null, 'Done.');
} );
// Wildcards - will answer anything within the context greet
inflicter.addict( null, 'peter', 'greet.*', function(callback){
harcon.addict( null, 'peter', 'greet.*', function(callback){
callback(null, 'Done.');
} );
// Regular expression - will answer anything where message name start with string 'job'
inflicter.addict( null, 'john', /job.*/, function( partner, callback){
harcon.addict( null, 'john', /job.*/, function( partner, callback){
callback(null, 'Done.');
} );
...
inflicter.simpleIgnite( 'job.order', {name: 'Stephen', customerID:123}, function(err, res){
harcon.simpleIgnite( 'job.order', {name: 'Stephen', customerID:123}, function(err, res){
console.log( 'Finished.', err, res );
} );
inflicter.simpleIgnite( 'john.job', {name: 'Stephen', customerID:123}, function(err, res){
harcon.simpleIgnite( 'john.job', {name: 'Stephen', customerID:123}, function(err, res){
console.log( 'Finished.', err, res );

@@ -123,3 +119,3 @@ } );

- objects: service object enclosing service functions as a unique and complete context. Recommended to be used as business entities.
- objects: plain object enclosing functions and a unique name. This is the recommended way to define entities.
```javascript

@@ -137,6 +133,6 @@ var bookKeeper = {

...
inflicter.simpleIgnite( 'BookKeeper.newOrder', {name: 'Stephen', customerID:123}, function(err, res){
harcon.simpleIgnite( 'BookKeeper.newOrder', {name: 'Stephen', customerID:123}, function(err, res){
console.log( 'Finished', err, res );
} );
inflicter.simpleIgnite( 'BookKeeper.ordersOfToday', function(err, res){
harcon.simpleIgnite( 'BookKeeper.ordersOfToday', function(err, res){
console.log( 'Finished.', err, res );

@@ -146,3 +142,3 @@ } );

Both component types must possess a unique name serving as the simplest way to send a message to. Or just simple using the regexp addressing any service function matching the pattern...
The simplest but not the only way to address is to quality entities with their names.

@@ -152,3 +148,3 @@

By default, [harcon](https://github.com/imrefazekas/harcon) returns and array of response objects returned by the entities addressed by a sent message.
By default, [harcon](https://github.com/imrefazekas/harcon) returns and array of response objects returned by the entities addressed by a message sent.

@@ -158,10 +154,10 @@ Let's have 2 simple entities:

```javascript
inflicter.addict( null, 'peter', 'greet.*', function(callback){
harcon.addict( null, 'peter', 'greet.*', function(callback){
callback(null, 'Hi.');
} );
inflicter.addict( null, 'camille', 'greet.*', function(callback){
harcon.addict( null, 'camille', 'greet.*', function(callback){
callback(null, 'Hello.');
} );
inflicter.simpleIgnite( 'greet.simple', function(err, res){
harcon.simpleIgnite( 'greet.simple', function(err, res){
console.error( err, res );

@@ -175,7 +171,7 @@ } );

(Note: for consistency reason, you got an array even if one entity.)
(Note: for consistency reason, you got an array even if one entity has been addressed.)
In some cases, you might find useful to know which answer comes from which entity. If you add a single parameter to the harcon:
var inflicter = new Inflicter( { namedResponses: true } );
var harcon = new Harcon( { namedResponses: true } );

@@ -186,13 +182,16 @@ The returned object will look like this:

#### Error responses
Your callback might receive an error object in unwanted situations. The default transport channel of harcon will stop the message processing at the first error occurring as follows:
```javascript
inflicter.addict( null, 'peter', 'greet.*', function(callback){
harcon.addict( null, 'peter', 'greet.*', function(callback){
callback( new Error('Stay away, please.') );
} );
inflicter.addict( null, 'camille', 'greet.*', function(callback){
harcon.addict( null, 'camille', 'greet.*', function(callback){
callback( new Error('Do not bother me.') );
} );
inflicter.simpleIgnite( 'greet.simple', function(err, res){
harcon.simpleIgnite( 'greet.simple', function(err, res){
console.error( err, res );

@@ -206,16 +205,16 @@ } );

The default transport layer is designed for development purposes or in-browser usage. In an EE, environment, please mind the introduction of a message queue solution like: [AMQP](http://www.amqp.org), [ZeroMQ](http://zeromq.org).
The default transport layer is designed for development purposes or in-browser usage only.
In an EE, environment, please mind the introduction of a message queue solution like: [AMQP](http://www.amqp.org), [ZeroMQ](http://zeromq.org) using official plugins: [harcon-amqp](https://github.com/imrefazekas/harcon-amqp) and [harcon-zero](https://github.com/imrefazekas/harcon-zero).
For [ZeroMQ](http://zeromq.org), you can find an "official" plugin here: [harcon-zero](https://github.com/imrefazekas/harcon-zero)
By using a real transport layer, all occurred error messages will be delegated. In such cases, harcon will retrieve an Error object encapsulating all error object received from entities.
By using different transport layer, all occurred error messages will be delegated.
In such cases, harcon will retrieve an Error object encapsulating all error object received from entities.
#### Orchestration
Basically, you define service functions which can be called through its name (object-based entity) or expression evaluation (function-based entity). When you orchestrate a complex system, you define object-based entities providing functions to be called.
There are 2 orthogonal ways to orchestrate such entities in your system.
You have seen how to call service functions using qualified names and regular expressions (function-based entity).
If a much structured system must be orchestrated, a set of finer toolset is at you disposal: __contexts and divisions__, representing different abstraction levels.
__Context__: a qualified name identifying the field/purpose the entity is operating. For example an entity parsing incoming JSON document can have the context "transfer" answering communications addressed to "transfer.parse" where __parse__ is the function provided by that entity. Within a given context, multiple entitiy can answer a communication with a given name.
__Context__: is a named set of object-based entities and contexts. a qualified name identifying the field/purpose the entity is operating. To refine the structure of your service.
For example you can have multiple entities providing service like _parse_ but in different contextes like: _"xml"_ or _"json"_.
You can structure your entities like the following:

@@ -225,3 +224,3 @@ ```javascript

name: 'JSONParser',
context: 'transfer',
context: 'transfer.json',
parse: function( document, callback ){

@@ -232,2 +231,25 @@ callback( null, 'Done.' );

var observer = {
name: 'XMLParser',
context: 'transfer.xml',
parse: function( document, callback ){
callback( null, null );
}
};
```
In this case, such messages can be sent:
```javascript
harcon.simpleIgnite( 'transfer.json.parse', function(err, res){ ... } );
or
harcon.simpleIgnite( 'transfer.xml.parse', function(err, res){ ... } );
or
harcon.simpleIgnite( 'transfer.'+document.type+'.parse', function(err, res){ ... } );
```
addressing directly to one of those entities, depending the type of the document you want to parse.
Let's define the following entity:
```javascript
var observer = {
name: 'Observer',

@@ -241,18 +263,31 @@ context: 'transfer',

Sending a message "transfer.parse" will be interpreted as follows:
context: "transfer"
functionSelector: "parse"
The entities published in the context "transfer" possessin the function "parse" will be notified and their service function will be invoked.
Such entity will also receive those message and might do logging or measuring or perform preliminary actions.
In short form: you can address multiple entities with a single message.
The matching algorithm is simple: spliting the title by _'.'_ matching with the context you specify and fails only if the compared strings are not equals.
This means, that:
A context might contain subcontexts depending on the complexity of your system.
__The title 'transfer.xml.parse' will target the XMLParser and Observer entities.__
and
__Division__: divisions is a diffferent angle of orchestrating entities. A division is a closed "box" of entities, meaning that an entity can operate only within the division it is member of. Every entity belongs to a division. Divisions can be encapsulated, so a complete division-tree can be built-up in a harcon application. The reason why divisions are important, because it represents a responsibility unit. Entities within it (in normal cases) cannot see outside and an entity published to a container division can answer to messages initiated by an entity somewhere lower in the tree. This gives you a control to define surveillance-like or control-like features and much higher complexity of communication-management.
__The title 'transfer.parse' will target the XMLParser, JSONParser and Observer entities.__
_Note_: these features are not mandatory to be used. The complexity will tell you how to orchestrate. If you only need function-based simple entities, feel free to go along with them. If you need to implement a highly structured money transaction management system in a financial environment, those features above will be urged to be defined.
Contexts are very good way to refine your structures and entities and express overlapping functional behaviors.
__Division__: divisions is a diffferent angle on the plane of orchestration. A _division_ is a closed "box" of entities, meaning that an entity can operate only within the division it is amember of.
In fact, every entity belongs to a division defined explicitly or implicitly by the harcon.
Divisions can be encapsulated, so a complete division-tree can be built-up in a harcon application.
The reason why divisions are important, because it represents a responsibility and/or legal unit. Entities within it (in normal cases) cannot see outside and an entity published to a container division can answer to messages initiated by an entity somewhere lower in the tree. This gives you a control to define surveillance-like or control-like features and much higher complexity of communication-management.
Please find the [Divisions](#divisions) chapter for details.
_Note_: contexts and divisions are not mandatory to be used. The complexity will tell you how to orchestrate your app. It might happen, that simple function-based named entities are fitting your need. Feel free to act on your own, there is no pattern to follow.
#### Chain messages
To chain messages, define the next point in the workflow you have to add another parameter to your service function:
If you work with workflows, the sequence/order of your messages will get an importance. To chain messages, define the next point in the workflow you have to add another parameter to your service function:
```javascript

@@ -269,7 +304,7 @@ var order = {

...
inflicter.simpleIgnite( 'order.newVPN', {name: 'Stephen', customerID:123}, function(err, res){
harcon.simpleIgnite( 'order.newVPN', {name: 'Stephen', customerID:123}, function(err, res){
console.log( 'Finished', err, res );
} );
```
That will initiate a small workflow. __inflicter.simpleIgnite__ sends a message to entity Order who will send within the same workflow to the Allocator. When it answeres, then the message of the beginning will be answered. [harcon](https://github.com/imrefazekas/harcon) will know if you initiate a message within the processing of another one and considers it as part of the ongoing workflow and tracks it.
That will initiate a small workflow. __harcon.simpleIgnite__ sends a message to entity Order who will send within the same workflow to the Allocator. When it answeres, then the message of the beginning will be answered. [harcon](https://github.com/imrefazekas/harcon) will know if you initiate a message within the processing of another one and considers it as part of the ongoing workflow and tracks it.
Mind the async execution to keep everything in track!

@@ -283,7 +318,7 @@

// Qualified name - will answer to only this message
inflicter.addict( null, 'karl', 'reserve.address', function( address ){
harcon.addict( null, 'karl', 'reserve.address', function( address ){
// Do something...
} );
...
inflicter.simpleIgnite( 'reserve.address', '127.0.0.1' );
harcon.simpleIgnite( 'reserve.address', '127.0.0.1' );
```

@@ -293,5 +328,5 @@

The need to pass contextual parameters to entities might rise. The options object passed to the constructure of Inflicter allows you to specify parameters for entities which will be passed while the init method defined in the entity is called.
The need to pass contextual parameters to entities might rise. The options object passed to the constructure of Harcon allows you to specify parameters for entities which will be passed while the init method defined in the entity is called.
```javascript
inflicter = new Inflicter( { /* ... */ marie: {greetings: 'Hi!'} } );
harcon = new Harcon( { /* ... */ marie: {greetings: 'Hi!'} } );
var marie = {

@@ -309,5 +344,5 @@ name: 'marie',

When you create the Inflicter instance, you can pass a logger object which will be respected and used to do loggings. If not set, [harcon](https://github.com/imrefazekas/harcon) will log everything to the console. So in production, setting up a logging facility ( like [winston](https://github.com/flatiron/winston) or [bunyan](https://github.com/trentm/node-bunyan) ) is strongly adviced.
When you create the Harcon instance, you can pass a logger object which will be respected and used to do loggings. If not set, [harcon](https://github.com/imrefazekas/harcon) will log everything to the console. So in production, setting up a logging facility ( like [winston](https://github.com/flatiron/winston) or [bunyan](https://github.com/trentm/node-bunyan) ) is strongly adviced.
```javascript
inflicter = new Inflicter( { logger: logger /* ... */ } );
harcon = new Harcon( { logger: logger /* ... */ } );
```

@@ -333,2 +368,3 @@

#### Unique messages

@@ -345,5 +381,5 @@

By default, [harcon](https://github.com/imrefazekas/harcon) uses 32 as length of the IDs which are unique over time and among computer nodes. You can override this default when initiating Inflicter
By default, [harcon](https://github.com/imrefazekas/harcon) uses 32 as length of the IDs which are unique over time and among computer nodes. You can override this default when initiating Harcon
```javascript
inflicter = new Inflicter( { /* ... */ idLength: 32 } );
harcon = new Harcon( { /* ... */ idLength: 32 } );
```

@@ -388,3 +424,3 @@

Systems can be orchastrated into divisions which is a tree structure actually. One can create divisions following the control-flow or responsibility-chain of the application.
When you orchastrate your system as a microservice architure over a clustered message bus for example, the individual microservicSystems can be orchastrated into divisions which is a tree structure actually. One can create divisions following the control-flow or responsibility-chain of the application.
Every component you deploy will belong to a division. If not declared, then to the system division where all system-level components are put.

@@ -399,3 +435,3 @@ Divisions is not just a logical grouping of components, but also an encapsulation-model. A component cannot send messages outside the own division but can send to the inner ones. This means, that system components can send to any component, but non-system components cannot reach the level of the main system or other branches of the division-tree.

// This will add John to the division 'workers'
inflicter.addict( 'workers', 'john', /job.*/, function(callback){
harcon.addict( 'workers', 'john', /job.*/, function(callback){
callback(null, 'Done.');

@@ -417,9 +453,9 @@ } );

```javascript
inflicter.ignite( null, 'entrance', 'greet.simple', 'Hi', 'Ca vas?', function(err, res){
harcon.ignite( null, 'entrance', 'greet.simple', 'Hi', 'Ca vas?', function(err, res){
} );
```
Note: please keep in mind, that __inflicter.ignite__ can be and should be used only when you initiate a workflow from outside the harcon!
Note: please keep in mind, that __harcon.ignite__ can be and should be used only when you initiate a workflow from outside the harcon!
If you inititate a communication through the inflicter instance, it means, that you wants to drop in a message "from outside" which could mean an integration with an external system or just kick off a workflow.
If you inititate a communication through the harcon instance, it means, that you wants to drop in a message "from outside" which could mean an integration with an external system or just kick off a workflow.
There are 2 methods to be called:

@@ -433,3 +469,7 @@

By default, [harcon](https://github.com/imrefazekas/harcon) presumes to have one division per node following the concept of microservices. Without eliminating this behavior, harcon will reject every publishing activity where the given entity has deviating division name.
```javascript
harcon = new Harcon( { divisionDeviation: true, ... } );
```

@@ -453,7 +493,7 @@ ## Entity configuration

```javascript
inflicter.addicts( Claire, config );
harcon.addicts( Claire, config );
```
or even before, when [harcon](https://github.com/imrefazekas/harcon) is created.
```javascript
inflicter = new Inflicter( { logger: logger, idLength: 32, Claire: {greetings: 'Hi!'} } );
harcon = new Harcon( { logger: logger, idLength: 32, Claire: {greetings: 'Hi!'} } );
```

@@ -467,3 +507,3 @@

name: 'As you design it',
context: inflicter.name,
context: harcon.name,
castOf: function( name, firestarter ){

@@ -476,5 +516,5 @@ },

}
inflicter.addicts( extension );
harcon.addicts( extension );
```
In the current version, the inflicter instance you are using will send to your components events about system closing, entity publishing and revoking. For a working example, please check [harcon-radiation](https://github.com/imrefazekas/harcon-radiation).
In the current version, the harcon instance you are using will send to your components events about system closing, entity publishing and revoking. For a working example, please check [harcon-radiation](https://github.com/imrefazekas/harcon-radiation).

@@ -481,0 +521,0 @@

@@ -6,3 +6,3 @@ var chai = require("chai");

// Requires harcon. In your app the form 'require('harcon');' should be used
var Inflicter = require('../lib/Inflicter');
var Harcon = require('../lib/Inflicter');

@@ -21,3 +21,3 @@ var Logger = require('./WinstonLogger');

// also initialize the deployer component which will automaticall publish every component found in folder './test/components'
inflicter = new Inflicter( { logger: logger, idLength: 32, marie: {greetings: 'Hi!'} } );
inflicter = new Harcon( { logger: logger, idLength: 32, Marie: {greetings: 'Hi!'}, divisionDeviation: true } );

@@ -48,3 +48,3 @@ inflicter.addicts( Publisher );

// Sending a greetings message with 2 parameters and waiting for the proper answer
inflicter.ignite( '0', '', 'marie.simple', 'whatsup?', 'how do you do?', function(err, res){
inflicter.ignite( '0', '', 'Marie.simple', 'whatsup?', 'how do you do?', function(err, res){
should.not.exist(err); should.exist(res);

@@ -59,3 +59,3 @@ expect( res ).to.include( 'Bonjour!' );

inflicter.ignite( '0', '', 'greet.simple', 'whatsup?', 'how do you do?', function(err, res){
console.log( err, res );
//console.log( err, res );
should.not.exist(err); should.exist(res);

@@ -74,3 +74,3 @@

inflicter.ignite( '0', '', 'morning.wakeup', function(err, res){
console.log( err, res );
//console.log( err, res );

@@ -83,6 +83,26 @@ expect(err).to.be.a('null');

it('General dormir', function(done){
inflicter.ignite( '0', '', 'morning.dormir', function(err, res){
//console.log( err, res );
expect(err).to.be.a('null');
expect(res).to.eql( [ 'Non, non, non!', 'Non, Mais non!' ] );
done( );
} );
});
it('Specific dormir', function(done){
inflicter.ignite( '0', '', 'morning.girls.dormir', function(err, res){
//console.log( err, res );
expect(err).to.be.a('null');
expect(res).to.eql( [ 'Non, non, non!', 'Non, Mais non!' ] );
done( );
} );
});
it('No answer', function(done){
// Sending a morning message and waiting for the proper answer
inflicter.ignite( '0', '', 'cave.echo', function(err, res){
console.log( err, res );
//console.log( err, res );

@@ -99,3 +119,3 @@ expect(err).to.be.an.instanceof( Error );

inflicter.ignite( '0', 'click', 'greet.simple', 'Hi', 'Ca vas?', function(err, res){
console.log( err, res );
//console.log( err, res );

@@ -115,5 +135,5 @@ should.not.exist(err); should.exist(res);

// Sending a morning message and waiting for the proper answer
inflicter.deactivate('claire');
inflicter.deactivate('Claire');
inflicter.ignite( '0', 'click', 'greet.simple', 'Hi', 'Ca vas?', function(err, res){
console.log( err, res );
//console.log( err, res );

@@ -120,0 +140,0 @@ should.not.exist(err); should.exist(res);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc