amalgamatic-drupal6
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -8,3 +8,3 @@ var querystring = require('querystring'); | ||
if (! query) { | ||
if (! query || ! query.searchTerm) { | ||
callback({data: []}); | ||
@@ -16,3 +16,3 @@ return; | ||
host: 'www.library.ucsf.edu', | ||
path: '/search/node/' + querystring.escape(query) | ||
path: '/search/node/' + querystring.escape(query.searchTerm) | ||
}; | ||
@@ -19,0 +19,0 @@ |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"dependencies": { | ||
@@ -11,0 +11,0 @@ "cheerio": "^0.17.0" |
@@ -22,4 +22,11 @@ /*jshint expr: true*/ | ||
it('returns an empty result if no query object provided', function (done) { | ||
drupal6.search(null, function (result) { | ||
expect(result).to.deep.equal({data:[]}); | ||
done(); | ||
}); | ||
}); | ||
it('returns an empty result if no search term provided', function (done) { | ||
drupal6.search('', function (result) { | ||
drupal6.search({searchTerm: ''}, function (result) { | ||
expect(result).to.deep.equal({data:[]}); | ||
@@ -35,3 +42,3 @@ done(); | ||
drupal6.search('medicine', function (result) { | ||
drupal6.search({searchTerm: 'medicine'}, function (result) { | ||
expect(result.data.length).to.equal(2); | ||
@@ -47,3 +54,3 @@ done(); | ||
drupal6.search('fhqwhgads', function (result) { | ||
drupal6.search({searchTerm: 'fhqwhgads'}, function (result) { | ||
expect(result.data.length).to.equal(0); | ||
@@ -56,3 +63,3 @@ done(); | ||
nock.disableNetConnect(); | ||
drupal6.search('medicine', function (result) { | ||
drupal6.search({searchTerm: 'medicine'}, function (result) { | ||
nock.enableNetConnect(); | ||
@@ -59,0 +66,0 @@ expect(result.data).to.be.undefined; |
5858
9
87