Release PrestaShop 1.2.0: use hook contracts
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
const { withHookFixtures } = require('./helpers/hook-fixtures');
|
||||
const assert = require('node:assert/strict');
|
||||
const Module = require('node:module');
|
||||
const path = require('node:path');
|
||||
@@ -33,7 +34,7 @@ test('discovers, downloads and persists a favicon once before registering the so
|
||||
get: async (key, fallback) => config.has(key) ? config.get(key) : fallback,
|
||||
set: async (key, value) => config.set(key, value),
|
||||
},
|
||||
Core: {
|
||||
Core: withHookFixtures({
|
||||
fetch: async url => {
|
||||
calls.push(url);
|
||||
if (url === 'https://shop.test/b2b/') {
|
||||
@@ -45,7 +46,7 @@ test('discovers, downloads and persists a favicon once before registering the so
|
||||
throw new Error(`Unexpected URL: ${url}`);
|
||||
},
|
||||
callModule: async (...args) => registered.push(args),
|
||||
},
|
||||
}),
|
||||
Log: { warn() {} },
|
||||
});
|
||||
|
||||
@@ -89,10 +90,10 @@ test('a failed refresh retains the last icon for the same shop', async () => {
|
||||
get: async () => stored,
|
||||
set: async (key, value) => { stored = value; },
|
||||
},
|
||||
Core: {
|
||||
Core: withHookFixtures({
|
||||
fetch: async () => ({ status: 503, data: Buffer.alloc(0), headers: {} }),
|
||||
callModule: async () => ({}),
|
||||
},
|
||||
}),
|
||||
Log: { warn() {} },
|
||||
});
|
||||
|
||||
@@ -108,7 +109,7 @@ test('a failed refresh retains the last icon for the same shop', async () => {
|
||||
});
|
||||
|
||||
test('favicon discovery rejects cross-host candidates and recognizes common binary formats', () => {
|
||||
const shopIcon = loadShopIcon({ Config: {}, Core: {}, Log: { warn() {} } });
|
||||
const shopIcon = loadShopIcon({ Config: {}, Core: withHookFixtures({}), Log: { warn() {} } });
|
||||
const candidates = shopIcon.faviconCandidates(
|
||||
'<link rel="icon" href="https://cdn.test/icon.png"><link rel="apple-touch-icon" href="/touch.png">',
|
||||
'https://shop.test/catalog/'
|
||||
|
||||
Reference in New Issue
Block a user