Bug 1663028 - Fix busted Pocket button tags and delete. r=gvn

Differential Revision: https://phabricator.services.mozilla.com/D89291
This commit is contained in:
Scott 2020-09-10 19:44:10 +00:00
Родитель c99e9821ef
Коммит aff2c781e1
3 изменённых файлов: 7 добавлений и 40 удалений

Просмотреть файл

@ -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,
};
})();

Просмотреть файл

@ -3,4 +3,3 @@ support-files =
head.js
[browser_pocket_main.js]
[browser_pocket_pktApi.js]

Просмотреть файл

@ -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");
});