bower-registry-client
Advanced tools
Comparing version 0.1.0-rc.2 to 0.1.0-rc.3
@@ -5,2 +5,3 @@ var path = require('path'); | ||
var request = require('request'); | ||
var replay = require('request-replay'); | ||
var Cache = require('./util/Cache'); | ||
@@ -94,3 +95,3 @@ var createError = require('./util/createError'); | ||
request.get(requestUrl, { | ||
replay(request.get(requestUrl, { | ||
proxy: remote.protocol === 'https:' ? config.httpsProxy : config.proxy, | ||
@@ -119,3 +120,3 @@ ca: config.ca.search[index], | ||
callback(null, body); | ||
}); | ||
})); | ||
} | ||
@@ -122,0 +123,0 @@ |
@@ -5,2 +5,3 @@ var path = require('path'); | ||
var request = require('request'); | ||
var replay = require('request-replay'); | ||
var createError = require('./util/createError'); | ||
@@ -85,3 +86,3 @@ var Cache = require('./util/Cache'); | ||
request.get(requestUrl, { | ||
replay(request.get(requestUrl, { | ||
proxy: remote.protocol === 'https:' ? config.httpsProxy : config.proxy, | ||
@@ -118,3 +119,3 @@ ca: config.ca.search[index], | ||
}); | ||
}); | ||
})); | ||
} | ||
@@ -121,0 +122,0 @@ |
var parseUrl = require('url').parse; | ||
var request = require('request'); | ||
var replay = require('request-replay'); | ||
var createError = require('./util/createError'); | ||
@@ -15,3 +16,3 @@ | ||
request.post({ | ||
replay(request.post({ | ||
url: requestUrl, | ||
@@ -52,5 +53,5 @@ proxy: remote.protocol === 'https:' ? config.httpsProxy : config.proxy, | ||
}); | ||
}); | ||
})); | ||
} | ||
module.exports = register; |
@@ -5,2 +5,3 @@ var path = require('path'); | ||
var request = require('request'); | ||
var replay = require('request-replay'); | ||
var Cache = require('./util/Cache'); | ||
@@ -101,3 +102,3 @@ var createError = require('./util/createError'); | ||
request.get(requestUrl, { | ||
replay(request.get(requestUrl, { | ||
proxy: remote.protocol === 'https:' ? config.httpsProxy : config.proxy, | ||
@@ -126,3 +127,3 @@ ca: config.ca.search[index], | ||
callback(null, body); | ||
}); | ||
})); | ||
} | ||
@@ -129,0 +130,0 @@ |
{ | ||
"name": "bower-registry-client", | ||
"version": "0.1.0-rc.2", | ||
"version": "0.1.0-rc.3", | ||
"description": "Provides easy interaction with the Bower registry.", | ||
@@ -22,6 +22,7 @@ "author": "Twitter", | ||
"async": "~0.2.8", | ||
"graceful-fs": "~1.2.2", | ||
"graceful-fs": "~2.0.0", | ||
"lru-cache": "~2.3.0", | ||
"request": "~2.21.0", | ||
"rimraf": "~2.1.4", | ||
"request": "~2.22.0", | ||
"request-replay": "~0.1.0", | ||
"rimraf": "~2.2.0", | ||
"mkdirp": "~0.3.5" | ||
@@ -28,0 +29,0 @@ }, |
@@ -7,3 +7,2 @@ var RegistryClient = require('../Client'), | ||
describe('RegistryClient', function () { | ||
beforeEach(function () { | ||
@@ -23,5 +22,3 @@ this.uri = 'https://bower.herokuapp.com'; | ||
describe('Constructor', function () { | ||
describe('instantiating a client', function () { | ||
it('should provide an instance of RegistryClient', function () { | ||
@@ -56,5 +53,4 @@ expect(this.registry instanceof RegistryClient).to.be.ok; | ||
it('should set default strictSsl config', function () { | ||
expect(this.registry._config.strictSsl).to.be.false; | ||
expect(this.registry._config.strictSsl).to.be(false); | ||
}); | ||
}); | ||
@@ -89,9 +85,6 @@ | ||
}); | ||
}); | ||
describe('instantiating a client with custom options', function () { | ||
describe('offline', function () { | ||
it('should not return search results ', function () { | ||
@@ -101,11 +94,9 @@ this.registry._config.offline = true; | ||
this.registry.search('jquery', function (err, results) { | ||
expect(err).to.be.null; | ||
expect(err).to.be(null); | ||
expect(results.length).to.eql(0); | ||
}); | ||
}); | ||
}); | ||
describe('cache', function () { | ||
beforeEach(function () { | ||
@@ -130,6 +121,6 @@ nock('https://bower.herokuapp.com:443') | ||
afterEach(function () { | ||
//this.client.clearCache(); | ||
this.client.clearCache(); | ||
}); | ||
it('should fill cache', function (done) { | ||
it('should fill cache', function (next) { | ||
var self = this; | ||
@@ -139,9 +130,9 @@ | ||
self.client.search(self.pkg, function (err, results) { | ||
expect(err).to.be.null; | ||
expect(err).to.be(null); | ||
expect(results.length).to.eql(334); | ||
// check for cache existance | ||
// check for cache existence | ||
fs.exists(self.path, function (exists) { | ||
expect(exists).to.be.true; | ||
done(); | ||
expect(exists).to.be(true); | ||
next(); | ||
}); | ||
@@ -152,16 +143,15 @@ }); | ||
it('should read results from cache', function (done) { | ||
it('should read results from cache', function (next) { | ||
var self = this; | ||
self.client.search(self.pkg, function (err, results) { | ||
expect(err).to.be.null; | ||
expect(err).to.be(null); | ||
expect(results.length).to.eql(334); | ||
fs.exists(self.path, function (exists) { | ||
expect(exists).to.be.true; | ||
done(); | ||
expect(exists).to.be(true); | ||
next(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -175,6 +165,5 @@ }); | ||
describe('calling the lookup instance method with argument', function () { | ||
it('should not return an error', function () { | ||
this.registry.lookup('jquery', function (err) { | ||
expect(err).to.be.null; | ||
expect(err).to.be(null); | ||
}); | ||
@@ -185,3 +174,3 @@ }); | ||
this.registry.lookup('jquery', function (err, entry) { | ||
expect(err).to.be.null; | ||
expect(err).to.be(null); | ||
expect(entry.type).to.eql('alias'); | ||
@@ -193,18 +182,15 @@ }); | ||
this.registry.lookup('jquery', function (err, entry) { | ||
expect(err).to.be.null; | ||
expect(err).to.be(null); | ||
expect(entry.url).to.eql('git://github.com/components/jquery.git'); | ||
}); | ||
}); | ||
}); | ||
describe('calling the lookup instance method without argument', function () { | ||
it('should return an error and no result', function () { | ||
this.registry.lookup('', function (err, entry) { | ||
expect(err).to.not.be.null; | ||
expect(entry).to.be.undefined; | ||
expect(err).to.not.be(null); | ||
expect(entry).to.be(undefined); | ||
}); | ||
}); | ||
}); | ||
@@ -217,3 +203,2 @@ | ||
describe('calling the register instance method with argument', function () { | ||
beforeEach(function () { | ||
@@ -228,29 +213,28 @@ nock('https://bower.herokuapp.com:443') | ||
it('should not return an error', function (done) { | ||
it('should not return an error', function (next) { | ||
this.registry.register(this.pkg, this.pkgUrl, function (err) { | ||
expect(err).to.be.null; | ||
done(); | ||
expect(err).to.be(null); | ||
next(); | ||
}); | ||
}); | ||
it('should return entry name', function (done) { | ||
it('should return entry name', function (next) { | ||
var self = this; | ||
this.registry.register(this.pkg, this.pkgUrl, function (err, entry) { | ||
expect(err).to.be.null; | ||
expect(err).to.be(null); | ||
expect(entry.name).to.eql(self.pkg); | ||
done(); | ||
next(); | ||
}); | ||
}); | ||
it('should return entry url', function (done) { | ||
it('should return entry url', function (next) { | ||
var self = this; | ||
this.registry.register(this.pkg, this.pkgUrl, function (err, entry) { | ||
expect(err).to.be.null; | ||
expect(err).to.be(null); | ||
expect(entry.url).to.eql(self.pkgUrl); | ||
done(); | ||
next(); | ||
}); | ||
}); | ||
}); | ||
@@ -261,4 +245,4 @@ | ||
this.registry.register('', '', function (err, entry) { | ||
expect(err).to.not.be.null; | ||
expect(entry).to.be.undefined; | ||
expect(err).to.not.be(null); | ||
expect(entry).to.be(undefined); | ||
}); | ||
@@ -273,3 +257,2 @@ }); | ||
describe('calling the search instance method with argument', function () { | ||
beforeEach(function () { | ||
@@ -284,10 +267,10 @@ nock('https://bower.herokuapp.com:443') | ||
it('should not return an error', function (done) { | ||
it('should not return an error', function (next) { | ||
this.registry.search(this.pkg, function (err) { | ||
expect(err).to.be.null; | ||
done(); | ||
expect(err).to.be(null); | ||
next(); | ||
}); | ||
}); | ||
it('should return entry name', function (done) { | ||
it('should return entry name', function (next) { | ||
var self = this; | ||
@@ -299,3 +282,3 @@ | ||
expect(entry.name).to.eql(self.pkg); | ||
done(); | ||
next(); | ||
} | ||
@@ -306,3 +289,3 @@ }); | ||
it('should return entry url', function (done) { | ||
it('should return entry url', function (next) { | ||
var self = this; | ||
@@ -314,3 +297,3 @@ | ||
expect(entry.url).to.eql(self.pkgUrl); | ||
done(); | ||
next(); | ||
} | ||
@@ -320,3 +303,2 @@ }); | ||
}); | ||
}); | ||
@@ -327,4 +309,4 @@ | ||
this.registry.search('', function (err, results) { | ||
expect(err).to.not.be.null; | ||
expect(results).to.be.undefined; | ||
expect(err).to.not.be(null); | ||
expect(results).to.be(undefined); | ||
}); | ||
@@ -339,3 +321,2 @@ }); | ||
describe('called the clearCache instance method with argument', function () { | ||
beforeEach(function () { | ||
@@ -347,3 +328,3 @@ this.pkg = 'jquery'; | ||
this.registry.clearCache(this.pkg, function (err) { | ||
expect(err).to.be.null; | ||
expect(err).to.be(null); | ||
}); | ||
@@ -354,10 +335,8 @@ }); | ||
describe('called the clearCache instance method without argument', function () { | ||
it('should not return any errors and remove all cache items', function () { | ||
this.registry.clearCache(function (err) { | ||
expect(err).to.be.null; | ||
expect(err).to.be(null); | ||
}); | ||
}); | ||
}); | ||
}); |
@@ -5,5 +5,3 @@ var index = require('../../lib/index'), | ||
describe('index module', function () { | ||
describe('requiring the index module', function () { | ||
it('should expose a lookup method', function () { | ||
@@ -24,5 +22,3 @@ expect(index.lookup).to.be.ok; | ||
}); | ||
}); | ||
}); |
@@ -5,5 +5,3 @@ var list = require('../../lib/list'), | ||
describe('list module', function () { | ||
describe('requiring the list module', function () { | ||
it('should expose a list method', function () { | ||
@@ -27,5 +25,3 @@ expect(typeof list === 'function').to.be.ok; | ||
}); | ||
}); | ||
}); |
@@ -5,5 +5,3 @@ var lookup = require('../../lib/lookup'), | ||
describe('lookup module', function () { | ||
describe('requiring the lookup module', function () { | ||
it('should expose a lookup method', function () { | ||
@@ -27,5 +25,3 @@ expect(typeof lookup === 'function').to.be.ok; | ||
}); | ||
}); | ||
}); |
@@ -5,11 +5,7 @@ var register = require('../../lib/register'), | ||
describe('register module', function () { | ||
describe('requiring the register module', function () { | ||
it('should expose a register method', function () { | ||
expect(typeof register === 'function').to.be.ok; | ||
}); | ||
}); | ||
}); |
@@ -5,5 +5,3 @@ var search = require('../../lib/search'), | ||
describe('search module', function () { | ||
describe('requiring the search module', function () { | ||
it('should expose a search method', function () { | ||
@@ -27,5 +25,3 @@ expect(typeof search === 'function').to.be.ok; | ||
}); | ||
}); | ||
}); |
@@ -5,3 +5,2 @@ var Cache = require('../../../lib/util/Cache'), | ||
describe('Cache', function () { | ||
beforeEach(function () { | ||
@@ -12,5 +11,3 @@ this.cache = new Cache(); | ||
describe('Constructor', function () { | ||
describe('instantiating cache', function () { | ||
it('should provide an instance of RegistryClient', function () { | ||
@@ -31,5 +28,3 @@ expect(this.cache instanceof Cache).to.be.ok; | ||
}); | ||
}); | ||
}); | ||
@@ -56,5 +51,3 @@ | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
79404
1323
7
+ Addedrequest-replay@~0.1.0
+ Addedassert-plus@0.1.5(transitive)
+ Addedctype@0.5.3(transitive)
+ Addedgraceful-fs@2.0.3(transitive)
+ Addedhttp-signature@0.10.1(transitive)
+ Addedrequest@2.22.0(transitive)
+ Addedrequest-replay@0.1.10(transitive)
+ Addedretry@0.6.1(transitive)
+ Addedrimraf@2.2.8(transitive)
- Removedassert-plus@0.1.2(transitive)
- Removedctype@0.5.2(transitive)
- Removedgraceful-fs@1.2.3(transitive)
- Removedhttp-signature@0.9.11(transitive)
- Removedrequest@2.21.0(transitive)
- Removedrimraf@2.1.4(transitive)
Updatedgraceful-fs@~2.0.0
Updatedrequest@~2.22.0
Updatedrimraf@~2.2.0