Skip to content

Commit c6b286e

Browse files
committed
chore: fix tests
1 parent 5e3a5ad commit c6b286e

File tree

10 files changed

+238
-294
lines changed

10 files changed

+238
-294
lines changed

src/routes/catalog/handler.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ const handlers = {
2525
// api:/{org}/{site}/catalog/{storeCode}/{viewCode}/lookup?urlkey={urlkey}
2626
GET: lookup,
2727
},
28-
product: {
28+
products: {
2929
// api:/{org}/{site}/catalog/{storeCode}/{viewCode}/products/{sku}.json
3030
GET: fetch,
31-
// api:/{org}/{site}/products/{storeCode}/{viewCode}/products/{sku}.json
31+
// api:/{org}/{site}/catalog/{storeCode}/{viewCode}/products/{sku}.json
3232
PUT: update,
33-
// api:/{org}/{site}/products/{storeCode}/{viewCode}/products/*
33+
// api:/{org}/{site}/catalog/{storeCode}/{viewCode}/products/*
3434
POST: async () => errorResponse(501, 'not implemented'),
35-
// api:/{org}/{site}/products/{storeCode}/{viewCode}/products/{sku}.json
35+
// api:/{org}/{site}/catalog/{storeCode}/{viewCode}/products/{sku}.json
3636
DELETE: remove,
3737
},
3838
};
@@ -54,8 +54,7 @@ export default async function handler(ctx, request) {
5454
return errorResponse(404, 'invalid path');
5555
}
5656

57-
const [storeCode, storeViewCode, subRoute, sku] = pathSegments.slice(4);
58-
57+
const [storeCode, storeViewCode, subRoute, sku] = pathSegments.slice(3);
5958
if (hasUppercase(sku)) {
6059
return errorResponse(400, 'Invalid SKU: SKU cannot contain uppercase letters');
6160
}

src/routes/catalog/remove.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
import { errorResponse } from '../../utils/http.js';
13+
import { errorResponse, errorWithResponse } from '../../utils/http.js';
1414
import StorageClient from './StorageClient.js';
1515

1616
/**
@@ -27,7 +27,7 @@ export default async function remove(ctx) {
2727
}
2828

2929
if (!config.helixApiKey) {
30-
throw errorResponse(400, 'Helix API key is required to delete or unpublish products.');
30+
throw errorWithResponse(400, 'Helix API key is required to delete or unpublish products.');
3131
}
3232

3333
const storage = StorageClient.fromContext(ctx);

src/routes/content/adobe-commerce.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ async function lookupProductSKUCS(urlkey, config) {
164164
async function lookupProductSKUCore(urlkey, config) {
165165
const query = getProductSKUQueryCore({ urlkey });
166166
if (!config.coreEndpoint) {
167-
throw errorResponse(400, 'missing coreEndpoint');
167+
throw errorWithResponse(400, 'missing coreEndpoint');
168168
}
169169
console.debug(query);
170170

0 commit comments

Comments
 (0)