-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add unit tests + change EventValidatorInterface to return promise whi…
…ch resolves to boolean (#2)
- Loading branch information
1 parent
d9d8d46
commit 5a274d6
Showing
15 changed files
with
1,310 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
language: node_js | ||
|
||
node_js: | ||
- "node" | ||
- "7" | ||
- "6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# Changelog | ||
|
||
## 1.0.0 - ? | ||
|
||
* Add unit tests | ||
* Bump @superbalist/js-pubsub to ^1.0.0 | ||
* Change `EventValidatorInterface` to return a promise which resolves to a boolean | ||
|
||
## 0.0.1 - 2017-05-03 | ||
|
||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use strict'; | ||
|
||
let chai = require('chai'); | ||
let expect = chai.expect; | ||
let dateAttributeInjector = require('../src/attribute_injectors/date_attribute_injector'); | ||
let hostnameAttributeInjector = require('../src/attribute_injectors/hostname_attribute_injector'); | ||
let uuid4AttributeInjector = require('../src/attribute_injectors/uuid4_attribute_injector'); | ||
let os = require('os'); | ||
|
||
describe('Attribute Injectors', () => { | ||
describe('date_attribute_injector', () => { | ||
it('should be a function ', () => { | ||
expect(dateAttributeInjector).to.be.a('function'); | ||
}); | ||
|
||
it('when called, should return an object with "key" and "value" properties', () => { | ||
let resolved = dateAttributeInjector(); | ||
expect(resolved).to.have.all.keys(['key', 'value']); | ||
}); | ||
|
||
it('when called, should return an object with a "key" property set to "date"', () => { | ||
let resolved = dateAttributeInjector(); | ||
expect(resolved.key).to.equal('date'); | ||
}); | ||
|
||
it('when called, should return an object with a "value" property set to the current ISO 8601 date"', () => { | ||
let resolved = dateAttributeInjector(); | ||
expect(resolved.value).to.equal((new Date()).toISOString()); | ||
}); | ||
}); | ||
|
||
describe('hostname_attribute_injector', () => { | ||
it('should be a function ', () => { | ||
expect(hostnameAttributeInjector).to.be.a('function'); | ||
}); | ||
|
||
it('when called, should return an object with "key" and "value" properties', () => { | ||
let resolved = hostnameAttributeInjector(); | ||
expect(resolved).to.have.all.keys(['key', 'value']); | ||
}); | ||
|
||
it('when called, should return an object with a "key" property set to "hostname"', () => { | ||
let resolved = hostnameAttributeInjector(); | ||
expect(resolved.key).to.equal('hostname'); | ||
}); | ||
|
||
it('when called, should return an object with a "value" property set to the hostname"', () => { | ||
let resolved = hostnameAttributeInjector(); | ||
expect(resolved.value).to.equal(os.hostname()); | ||
}); | ||
}); | ||
|
||
describe('uuid4_attribute_injector', () => { | ||
it('should be a function ', () => { | ||
expect(uuid4AttributeInjector).to.be.a('function'); | ||
}); | ||
|
||
it('when called, should return an object with "key" and "value" properties', () => { | ||
let resolved = uuid4AttributeInjector(); | ||
expect(resolved).to.have.all.keys(['key', 'value']); | ||
}); | ||
|
||
it('when called, should return an object with a "key" property set to "uuid"', () => { | ||
let resolved = uuid4AttributeInjector(); | ||
expect(resolved.key).to.equal('uuid'); | ||
}); | ||
|
||
it('when called, should return an object with a "value" property matching a uui4 regex"', () => { | ||
let resolved = uuid4AttributeInjector(); | ||
expect(resolved.value).to.match(/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.