Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update Airship Dependencies

* Use Nock 0.18.0
* Use Chai instead of Should
* Use Mocha 1.9.0
* Testing against Node 0.9, 0.10
  • Loading branch information...
commit ae506ee3bccb4e90211faf96aefa605c46bbbb0e 1 parent 3891283
@jherdman authored
View
2  .travis.yml
@@ -2,3 +2,5 @@ language: node_js
node_js:
- 0.6
- 0.8
+ - 0.9
+ - 0.10
View
1  Makefile
@@ -3,7 +3,6 @@ REPORTER = spec
spec:
@NODE_ENV=test ./node_modules/.bin/mocha \
- --require should \
--require nock \
--reporter $(REPORTER) \
--growl \
View
6 package.json
@@ -17,9 +17,9 @@
"dependencies": {
},
"devDependencies": {
- "mocha": "~1.0.0",
- "should": "~0.6.0",
- "nock": "~0.11.2"
+ "mocha": "~1.9.0",
+ "chai": "~1.6.0",
+ "nock": "~0.18.0"
},
"main": "index",
"scripts": {
View
19 spec/airship_spec.js
@@ -1,4 +1,5 @@
-var Airship = require('../lib/airship').Airship
+var expect = require('chai').expect
+ , Airship = require('../lib/airship').Airship
, airship = new Airship('foo', 'bar')
, nock = require('nock')
, uas = nock('https://go.urbanairship.com')
@@ -11,24 +12,28 @@ describe('Airship', function () {
describe('constructor', function () {
it('sets the app key', function () {
var a = new Airship('foo', 'bar');
- a.appKey.should.eql('foo');
+ expect(a.appKey).to.eql('foo');
});
it('sets the master secret', function () {
var a = new Airship('foo', 'bar');
- a.masterSecret.should.eql('bar');
+ expect(a.masterSecret).to.eql('bar');
});
it('throws an error if an app key is not provided', function () {
- (function () {
+ var fn = function () {
var a = new Airship();
- }).should.throw('You must provide an app key');
+ };
+
+ expect(fn).to.throw('You must provide an app key');
});
it('throws an error if a master secret is not provided', function () {
- (function () {
+ var fn = function () {
var a = new Airship('fooo');
- }).should.throw('You must provide your master secret');
+ };
+
+ expect(fn).to.throw('You must provide your master secret');
});
});
View
5 spec/index_spec.js
@@ -1,9 +1,10 @@
-var uas = require('../lib/index')
+var expect = require('chai').expect
+ , uas = require('../lib/index')
, Airship = require('../lib/airship').Airship;
describe('Main public interface', function () {
it('creates an Airship instance', function () {
var airship = uas.createAirship('foo', 'bar');
- airship.should.be.instanceof(Airship);
+ expect(airship).to.be.instanceOf(Airship);
});
});
View
21 spec/request_spec.js
@@ -1,4 +1,5 @@
-var Request = require('../lib/request').Request
+var expect = require('chai').expect
+ , Request = require('../lib/request').Request
, nock = require('nock')
, dummyService = nock('https://go.urbanairship.com');
@@ -7,7 +8,7 @@ describe('Request', function () {
it('sets the auth params to the options', function () {
var req = new Request({});
req.setAuth('foo', 'bar');
- req.options.auth.should.eql('foo:bar');
+ expect(req.options.auth).to.eql('foo:bar');
});
});
@@ -31,7 +32,7 @@ describe('Request', function () {
req.options.method = 'GET';
req.on('success', function (d) {
- d.should.eql('OKAY');
+ expect(d).to.eql('OKAY');
done();
});
@@ -43,7 +44,7 @@ describe('Request', function () {
req.options.method = 'GET';
req.on('success', function (d) {
- d.should.eql({ my: 'data' });
+ expect(d).to.eql({ my: 'data' });
done();
});
@@ -55,7 +56,7 @@ describe('Request', function () {
req.options.method = 'GET';
req.on('fail', function (d) {
- d.should.eql('CLIENT ERROR');
+ expect(d).to.eql('CLIENT ERROR');
done();
});
@@ -65,7 +66,7 @@ describe('Request', function () {
it('returns the instance', function () {
var req = new Request({ path: '/yupyup' });
req.options.method = 'GET';
- req.apiCall().should.be.instanceof(Request);
+ expect(req.apiCall()).to.be.instanceOf(Request);
});
});
@@ -92,7 +93,7 @@ describe('Request', function () {
it('returns the instance', function () {
var req = new Request({ path: '/pickle' });
- req.put().should.be.instanceof(Request);
+ expect(req.put()).to.be.instanceOf(Request);
});
});
@@ -119,7 +120,7 @@ describe('Request', function () {
it('returns the instance', function () {
var req = new Request({ path: '/spoon' });
- req.post().should.be.instanceof(Request);
+ expect(req.post()).to.be.instanceOf(Request);
});
});
@@ -139,7 +140,7 @@ describe('Request', function () {
it('returns the instance', function () {
var req = new Request({ path: '/bark' });
- req.get().should.be.instanceof(Request);
+ expect(req.get()).to.be.instanceOf(Request);
});
});
@@ -159,7 +160,7 @@ describe('Request', function () {
it('returns the instance', function () {
var req = new Request({ path: '/bat' });
- req.delete().should.be.instanceof(Request);
+ expect(req.delete()).to.be.instanceOf(Request);
});
});
});
View
38 spec/utils_spec.js
@@ -1,66 +1,74 @@
-var utils = require('../lib/utils');
+var expect = require('chai').expect
+ , utils = require('../lib/utils');
describe('utils', function () {
describe('#merge', function () {
it('merges the properties of two objects into a new one', function () {
var o1 = { foo: 'bar' }
- , o2 = { baz: 'qux' };
+ , o2 = { baz: 'qux' }
+ , result = utils.merge(o1, o2);
- utils.merge(o1, o2).should.have.keys('foo', 'baz');
+ expect(result).to.have.ownProperty('foo');
+ expect(result).to.have.ownProperty('baz');
});
it('merges three objects properties into a new one', function () {
var o1 = { foo: 'bar' }
, o2 = { baz: 'qux' }
- , o3 = { qui: 'abc' };
+ , o3 = { qui: 'abc' }
+ , result = utils.merge(o1, o2, o3);
- utils.merge(o1, o2, o3).should.have.keys('foo', 'baz', 'qui');
+ expect(result).to.have.ownProperty('foo');
+ expect(result).to.have.ownProperty('baz');
+ expect(result).to.have.ownProperty('qui');
});
it('does not attempt to merge a non-object', function () {
- (function () {
+ var fn = function () {
utils.merge({ foo: 'bar' }, null);
- }).should.not.throw(/^TypeError/);
+ };
+
+ expect(fn).to.not.throw(/^TypeError/);
});
});
describe('#tagPath', function () {
it('builds a generic tags path', function () {
- utils.tagPath().should.eql('/api/tags/');
+ expect(utils.tagPath()).to.eql('/api/tags/');
});
it('builds a tag path with a named tag', function () {
- utils.tagPath('bacon').should.eql('/api/tags/bacon');
+ expect(utils.tagPath('bacon')).to.eql('/api/tags/bacon');
});
});
describe('#deviceTokenPath', function () {
it('builds a generic device path', function () {
- utils.deviceTokenPath().should.eql('/api/device_tokens/');
+ expect(utils.deviceTokenPath()).to.eql('/api/device_tokens/');
});
it('builds a device path for a specific device', function () {
- utils.deviceTokenPath('CAFEBABE').should.eql('/api/device_tokens/CAFEBABE');
+ expect(utils.deviceTokenPath('CAFEBABE')).to.eql('/api/device_tokens/CAFEBABE');
});
});
describe('#deviceTokenTagPath', function () {
it('builds a path for tags on a device', function () {
- utils.deviceTokenTagPath('CAFEBABE').should.eql('/api/device_tokens/CAFEBABE/tags/');
+ expect(utils.deviceTokenTagPath('CAFEBABE')).to.eql('/api/device_tokens/CAFEBABE/tags/');
});
it('builds a path for a tag on a device', function () {
- utils.deviceTokenTagPath('CAFEBABE', 'bacon').should.eql('/api/device_tokens/CAFEBABE/tags/bacon');
+ expect(utils.deviceTokenTagPath('CAFEBABE', 'bacon')).to.eql('/api/device_tokens/CAFEBABE/tags/bacon');
});
});
describe('#scheduledPushPath', function () {
it('builds a path to a specific scheduled push message', function () {
- utils.scheduledPushPath('burp').should.eql('/api/push/scheduled/burp');
+ expect(utils.scheduledPushPath('burp')).to.eql('/api/push/scheduled/burp');
});
it('builds a path to the scheduled push end point', function () {
- utils.scheduledPushPath().should.eql('/api/push/scheduled/');
+ expect(utils.scheduledPushPath()).to.eql('/api/push/scheduled/');
});
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.