diff --git a/browser/components/pocket/content/pktApi.jsm b/browser/components/pocket/content/pktApi.jsm index 8c504045e5a2..424eb4a7b805 100644 --- a/browser/components/pocket/content/pktApi.jsm +++ b/browser/components/pocket/content/pktApi.jsm @@ -355,7 +355,7 @@ var pktApi = (function() { sendData.title = options.title; } - return this.apiRequest({ + return apiRequest({ path: "/firefox/save", data: sendData, success(data) { @@ -402,7 +402,7 @@ var pktApi = (function() { * @return {Boolean} Returns Boolean whether the api call started sucessfully */ function getRecsForItem(itemId, options) { - return this.apiRequest({ + return apiRequest({ path: "/discover/recIt", data: { item_id: itemId, @@ -425,7 +425,7 @@ var pktApi = (function() { * @return {Boolean} Returns Boolean whether the api call started sucessfully */ function getArticleInfo(url, options) { - return this.apiRequest({ + return apiRequest({ path: "/getItemPreview", data: { access_token: getAccessToken(), @@ -446,7 +446,7 @@ var pktApi = (function() { * @return {Boolean} Returns Boolean whether the api call started sucessfully */ function getMobileDownload(options) { - return this.apiRequest({ + return apiRequest({ path: "/firefox/get-app", data: { access_token: getAccessToken(), @@ -519,7 +519,7 @@ var pktApi = (function() { * @return {Boolean} Returns Boolean whether the api call started sucessfully */ function sendActions(actions, options) { - return this.apiRequest({ + return apiRequest({ path: "/send", data: { access_token: getAccessToken(), @@ -696,7 +696,7 @@ var pktApi = (function() { data.access_token = getAccessToken(); - return this.apiRequest({ + return apiRequest({ path: "/getSuggestedTags", data, success: options.success, @@ -712,7 +712,7 @@ var pktApi = (function() { const requestData = Object.assign({}, data, { access_token: getAccessToken(), }); - return this.apiRequest({ + return apiRequest({ path: "/firefox/get", data: requestData, success: options.success, @@ -770,6 +770,5 @@ var pktApi = (function() { retrieve, getArticleInfo, getMobileDownload, - apiRequest, }; })(); diff --git a/browser/components/pocket/test/unit/browser.ini b/browser/components/pocket/test/unit/browser.ini index 3fc2b7275d5a..cbda29ed00cf 100644 --- a/browser/components/pocket/test/unit/browser.ini +++ b/browser/components/pocket/test/unit/browser.ini @@ -3,4 +3,3 @@ support-files = head.js [browser_pocket_main.js] -[browser_pocket_pktApi.js] diff --git a/browser/components/pocket/test/unit/browser_pocket_pktApi.js b/browser/components/pocket/test/unit/browser_pocket_pktApi.js deleted file mode 100644 index 05960de7f2b4..000000000000 --- a/browser/components/pocket/test/unit/browser_pocket_pktApi.js +++ /dev/null @@ -1,31 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ -"use strict"; - -function test_runner(test) { - let testTask = async () => { - // Before each - const sandbox = sinon.createSandbox(); - try { - await test({ sandbox }); - } finally { - // After each - sandbox.restore(); - } - }; - - // Copy the name of the test function to identify the test - Object.defineProperty(testTask, "name", { value: test.name }); - add_task(testTask); -} - -test_runner(async function test_pktpi_getRecsForItem({ sandbox }) { - const apiRequestStub = sandbox.stub(pktApi, "apiRequest"); - - pktApi.getRecsForItem("1234", { - success() {}, - }); - - Assert.ok(apiRequestStub.calledOnce); - Assert.equal(apiRequestStub.getCall(0).args[0].data.item_id, "1234"); -});