Added notification config to .travis.yml
diff --git a/.travis.yml b/.travis.yml
index 68a7676..b960342 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,4 +5,8 @@
- 'npm install'
- 'npm -g install mocha'
script:
-- 'mocha tests'
\ No newline at end of file
+- 'mocha tests'
+notifications:
+ email:
+ on_failure: change
+ on_success: change
\ No newline at end of file
diff --git a/tests/lib/client.test.js b/tests/lib/client.test.js
index 54e6a39..8b42ccd 100644
--- a/tests/lib/client.test.js
+++ b/tests/lib/client.test.js
@@ -17,15 +17,15 @@
it('should initialize using properties defined in config.json', function() {
var client = new UsergridClient()
- client.should.be.an.instanceof(UsergridClient).with.property('orgId').equal(config.usergrid.orgId)
- client.should.be.an.instanceof(UsergridClient).with.property('appId').equal(config.usergrid.appId)
+ client.should.be.an.instanceof(UsergridClient).and.have.property('orgId').equal(config.usergrid.orgId)
+ client.should.be.an.instanceof(UsergridClient).and.have.property('appId').equal(config.usergrid.appId)
Object(client).should.containDeep(config.usergrid)
})
it('should initialize when passing orgId and appId as arguments, taking precedence over config', function() {
var client = new UsergridClient('foo', 'bar')
- client.should.be.an.instanceof(UsergridClient).with.property('orgId').equal('foo')
- client.should.be.an.instanceof(UsergridClient).with.property('appId').equal('bar')
+ client.should.be.an.instanceof(UsergridClient).and.have.property('orgId').equal('foo')
+ client.should.be.an.instanceof(UsergridClient).and.have.property('appId').equal('bar')
})
it('should initialize when passing an object containing orgId and appId, taking precedence over config', function() {
@@ -33,8 +33,8 @@
orgId: 'foo',
appId: 'bar'
})
- client.should.be.an.instanceof(UsergridClient).with.property('orgId').equal('foo')
- client.should.be.an.instanceof(UsergridClient).with.property('appId').equal('bar')
+ client.should.be.an.instanceof(UsergridClient).and.have.property('orgId').equal('foo')
+ client.should.be.an.instanceof(UsergridClient).and.have.property('appId').equal('bar')
})
})
@@ -46,41 +46,35 @@
before(function(done) {
client = new UsergridClient()
client.GET(_collection, function(err, usergridResponse) {
+ response = usergridResponse
done()
})
})
-
-
- it('should not fail when a callback function is not passed', function(done) {
+ it('should not fail when a callback function is not passed', function() {
// note: this test will NOT fail gracefully inside the Mocha event chain
+ console.log(response)
client.GET(_collection)
- done()
})
- it('should return a 200 ok', function(done) {
+ it('should return a 200 ok', function() {
response.statusCode.should.equal(200)
- done()
})
- it('response.entities should be an array', function(done) {
+ it('response.entities should be an array', function() {
response.entities.should.be.an.Array
- done()
})
- it('response.first should exist and have a valid uuid', function(done) {
- response.first.should.be.an.Object.with.property('uuid').with.a.lengthOf(36)
- done()
+ it('response.first should exist and have a valid uuid', function() {
+ response.first.should.be.an.Object.and.have.property('uuid').and.have.a.lengthOf(36)
})
- it('response.entity should exist and have a valid uuid', function(done) {
- response.entity.should.be.an.Object.with.property('uuid').with.a.lengthOf(36)
- done()
+ it('response.entity should exist and have a valid uuid', function() {
+ response.entity.should.be.an.Object.and.have.property('uuid').and.have.a.lengthOf(36)
})
- it('response.last should exist and have a valid uuid', function(done) {
- response.last.should.be.an.Object.with.property('uuid').with.a.lengthOf(36)
- done()
+ it('response.last should exist and have a valid uuid', function() {
+ response.last.should.be.an.Object.and.have.property('uuid').and.have.a.lengthOf(36)
})
})
@@ -101,30 +95,25 @@
})
})
- it('should not fail when a callback function is not passed', function(done) {
+ it('should not fail when a callback function is not passed', function() {
// note: this test will NOT fail gracefully inside the Mocha event chain
client.POST(_collection, {})
- done()
})
- it('should return a 200 ok', function(done) {
+ it('should return a 200 ok', function() {
response.statusCode.should.equal(200)
- done()
})
- it('response.entities should be an array', function(done) {
- response.entities.should.be.an.Array.with.a.lengthOf(1)
- done()
+ it('response.entities should be an array', function() {
+ response.entities.should.be.an.Array.and.have.a.lengthOf(1)
})
- it('response.entity should exist and have a valid uuid', function(done) {
- response.entity.should.be.an.Object.with.property('uuid').with.a.lengthOf(36)
- done()
+ it('response.entity should exist and have a valid uuid', function() {
+ response.entity.should.be.an.Object.and.have.property('uuid').and.have.a.lengthOf(36)
})
- it('response.entity.author should equal "Sir Arthur Conan Doyle"', function(done) {
+ it('response.entity.author should equal "Sir Arthur Conan Doyle"', function() {
response.entity.should.have.property('author').equal('Sir Arthur Conan Doyle')
- done()
})
})
@@ -144,30 +133,25 @@
})
})
- it('should not fail when a callback function is not passed', function(done) {
+ it('should not fail when a callback function is not passed', function() {
// note: this test will NOT fail gracefully inside the Mocha event chain
client.PUT(_collection, _uuid)
- done()
})
- it('should return a 200 ok', function(done) {
+ it('should return a 200 ok', function() {
response.statusCode.should.equal(200)
- done()
})
- it('response.entities should be an array', function(done) {
- response.entities.should.be.an.Array.with.a.lengthOf(1)
- done()
+ it('response.entities should be an array', function() {
+ response.entities.should.be.an.Array.and.have.a.lengthOf(1)
})
- it('response.entity should exist and its uuid should the uuid from the previous POST requets', function(done) {
- response.entity.should.be.an.Object.with.property('uuid').equal(_uuid)
- done()
+ it('response.entity should exist and its uuid should the uuid from the previous POST requets', function() {
+ response.entity.should.be.an.Object.and.have.property('uuid').equal(_uuid)
})
- it('response.entity.narrator should equal "Peter Doyle"', function(done) {
+ it('response.entity.narrator should equal "Peter Doyle"', function() {
response.entity.should.have.property('narrator').equal('Peter Doyle')
- done()
})
})
@@ -187,22 +171,19 @@
})
})
- it('should not fail when a callback function is not passed', function(done) {
+ it('should not fail when a callback function is not passed', function() {
// note: this test will NOT fail gracefully inside the Mocha event chain
client.DELETE(_collection, _uuid)
- done()
})
- it('should return a 200 ok', function(done) {
+ it('should return a 200 ok', function() {
// This should check for 404, but because of a Usergrid bug, it returns 401 instead of 404.
// see https://issues.apache.org/jira/browse/USERGRID-1128
response.statusCode.should.not.equal(200)
- done()
})
- it('response.error.name should equal "service_resource_not_found"', function(done) {
+ it('response.error.name should equal "service_resource_not_found"', function() {
response.error.name.should.equal('service_resource_not_found')
- done()
})
})
@@ -222,25 +203,21 @@
})
})
- it('should return a 200 ok', function(done) {
+ it('should return a 200 ok', function() {
response.statusCode.should.equal(200)
- done()
})
- it('should have a valid token', function(done) {
+ it('should have a valid token', function() {
token.should.be.a.String
token.length.should.be.greaterThan(10)
- done()
})
- it('client.appAuth.token should be set to the token returned from Usergrid', function(done) {
+ it('client.appAuth.token should be set to the token returned from Usergrid', function() {
client.appAuth.should.have.property('token').equal(token)
- done()
})
- it('client.appAuth.expiry should be set to a future date', function(done) {
+ it('client.appAuth.expiry should be set to a future date', function() {
client.appAuth.should.have.property('expiry').greaterThan(Date.now())
- done()
})
})