-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added testing with Node@6 #4
base: master
Are you sure you want to change the base?
Changes from 6 commits
315c4f9
615c93b
8133b03
466c8d2
6df1e34
d63784c
8e2da9d
9cb3744
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
language: node_js | ||
sudo: false | ||
services: | ||
- redis-server | ||
|
||
env: | ||
- [email protected] | ||
|
@@ -10,6 +12,14 @@ node_js: | |
- "0.12" | ||
- "4" | ||
- "5" | ||
- "6" | ||
|
||
before_script: | ||
- if [[ $TRAVIS_NODE_VERSION == "6" ]]; then export LAB_FLAGS="--leaks"; else export LAB_FLAGS=""; fi | ||
- npm uninstall seneca | ||
- npm install seneca$SENECA_VER | ||
- echo FLAGS:$LAB_FLAGS | ||
|
||
after_script: | ||
- nsp check | ||
- npm run coverage |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
var seneca = require('seneca')() | ||
var Moment = require('moment') | ||
var Assert = require('assert') | ||
var should = require('chai').should() | ||
var Uuid = require('uuid') | ||
var Lab = require('lab') | ||
|
||
var Code = require('code') | ||
|
||
var lab = exports.lab = Lab.script() | ||
var describe = lab.describe | ||
var before = lab.before | ||
var it = lab.it | ||
var expect = Code.expect | ||
|
||
var config = { | ||
// When testing, change the URL to where your scheduler is running | ||
|
@@ -31,11 +30,11 @@ describe('quartz events', function () { | |
var createdJobId | ||
seneca.add({role: role, cmd: cmdId}, function (args, callback) { | ||
var now = Date.now() | ||
now.should.be.above(registeredAt) | ||
args.data.one.should.equal('#1') | ||
args.data.two.should.equal('#2') | ||
Assert.ok(args.jobId) | ||
Assert.equal(args.jobId, createdJobId) | ||
expect(now).to.be.above(registeredAt) | ||
expect(args.data.one).to.equal('#1') | ||
expect(args.data.two).to.equal('#2') | ||
expect(args.jobId) | ||
expect(args.jobId).to.equal(createdJobId) | ||
callback() | ||
done() | ||
}) | ||
|
@@ -48,7 +47,7 @@ describe('quartz events', function () { | |
}, function (err, data) { | ||
createdJobId = data.jobId | ||
registeredAt = Date.now() | ||
should.not.exist(err) | ||
expect(err).to.not.exist() | ||
}) | ||
}) | ||
|
||
|
@@ -69,9 +68,9 @@ describe('quartz events', function () { | |
when: Moment().add(10, 'minutes').toDate(), | ||
args: {role: role, cmd: cmdId, data: {some: 'random data'}} | ||
}, function (err, data) { | ||
should.not.exist(err) | ||
should.exist(data) | ||
should.exist(data.jobId) | ||
expect(err).to.not.exist() | ||
expect(data) | ||
expect(data.jobId) | ||
taskData = data | ||
done() | ||
}) | ||
|
@@ -85,9 +84,9 @@ describe('quartz events', function () { | |
cmd: 'deregister', | ||
jobId: taskData.jobId | ||
}, function (err, data) { | ||
should.not.exist(err) | ||
expect(err.code).to.contain('result_not_objarr') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems to be different than the original code |
||
data = JSON.parse(data) | ||
data.key.should.equal('true') | ||
expect(data.key).to.equal('true') | ||
done() | ||
}) | ||
}) | ||
|
@@ -109,21 +108,19 @@ describe('quartz events', function () { | |
when: Moment().add(10, 'minutes').toDate(), | ||
args: {role: role, cmd: cmdId, data: {payload_number: '#1'}} | ||
}, function (err, data) { | ||
should.not.exist(err) | ||
should.exist(data) | ||
should.exist(data.jobId) | ||
expect(err).to.not.exist() | ||
expect(data) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
expect(data.jobId) | ||
taskData = data | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
||
it('should update a task to fire in 2 seconds and receive the notification', function (done) { | ||
this.timeout(5000) | ||
|
||
var cmdId = Uuid.v4() | ||
seneca.add({role: role, cmd: cmdId}, function (args, callback) { | ||
args.data.payload_number.should.equal('#2') | ||
expect(args.data.payload_number).to.equal('#2') | ||
done() | ||
}) | ||
|
||
|
@@ -135,10 +132,11 @@ describe('quartz events', function () { | |
jobId: taskData.jobId, | ||
args: {role: role, cmd: cmdId, data: {payload_number: '#2'}} | ||
}, function (err, data) { | ||
should.not.exist(err) | ||
should.exist(data) | ||
should.exist(data.jobId) | ||
expect(err).to.not.exist() | ||
expect(data) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
expect(data.jobId) | ||
taskData = data | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect to be not null or something