Skip to content

Commit faa9f58

Browse files
authored
check product change fix (#258)
fixed an issue where check-product-change was calling fileLib.delete without the file's extension. updated auto test to account for the file extension
1 parent 2209ca7 commit faa9f58

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

actions/check-product-changes/poller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ async function processDeletedProducts(remainingSkus, state, context, adminApi) {
309309
if (record.liveUnpublishedAt && record.previewUnpublishedAt) {
310310
// Delete the HTML file from public storage
311311
try {
312-
const htmlPath = `/public/pdps${record.path}`;
312+
const htmlPath = `/public/pdps${record.path}.${PDP_FILE_EXT}`;
313313
filesLib.delete(htmlPath);
314314
logger.debug(`Deleted HTML file for product ${record.sku} from ${htmlPath}`);
315315
} catch (e) {

test/check-product-changes.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,8 @@ describe('Poller', () => {
587587

588588
// Verify HTML files were deleted
589589
expect(filesLib.delete).toHaveBeenCalledTimes(2);
590-
expect(filesLib.delete).toHaveBeenCalledWith('/public/pdps/p/url-sku-123');
591-
expect(filesLib.delete).toHaveBeenCalledWith('/public/pdps/p/url-sku-456');
590+
expect(filesLib.delete).toHaveBeenCalledWith('/public/pdps/p/url-sku-123.html');
591+
expect(filesLib.delete).toHaveBeenCalledWith('/public/pdps/p/url-sku-456.html');
592592
});
593593
});
594594
});

0 commit comments

Comments
 (0)