Skip to content

Commit 827ee25

Browse files
committed
Add tests
1 parent c480459 commit 827ee25

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/apifetch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var executeApiFetch = function(type, keyword, cb) {
2727
kw = encodeURIComponent(kw);
2828

2929
// Execute API call
30-
fetch('https://api.addsearch.com/v1/' + type + '/' + this.sitekey + '?term=' + kw)
30+
fetch('https://api.addsearch.com/v1/' + type + '/' + (this ? this.sitekey : null) + '?term=' + kw)
3131
.then(function(response) {
3232
return response.json();
3333
}).then(function(json) {

test/apifetch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('apifetch', function() {
1010
fetchMock.get('*', { response: 200 });
1111
const expect = {response: 200};
1212

13-
apifetch.executeApiFetch('search', 'keyword', (res) => {
13+
apifetch('search', 'keyword', (res) => {
1414
assert.deepEqual(res, expect);
1515
});
1616
});
@@ -20,7 +20,7 @@ describe('apifetch', function() {
2020
fetchMock.get('*', 'foo');
2121
const expect = 400;
2222

23-
apifetch.executeApiFetch('ping', 'keyword', (res) => {
23+
apifetch('ping', 'keyword', (res) => {
2424
assert.equal(res.error.response, expect);
2525
});
2626
});

0 commit comments

Comments
 (0)