feat: add public product detail web flow

This commit is contained in:
2026-09-08 19:56:44 -04:00
parent 7e5ca1448f
commit 5916ce1ff5
6 changed files with 74 additions and 0 deletions
+15
View File
@@ -30,4 +30,19 @@ test('encodes catalog search pagination in the API request', async () => {
} finally {
globalThis.fetch = originalFetch;
}
});
test('fetches a public product using its stable slug URL', async () => {
const originalFetch = globalThis.fetch;
globalThis.fetch = async (url) => {
assert.equal(url, 'http://localhost:3000/api/v1/public/products/pikachu-plush');
return { ok: true, async json() { return { data: { slug: 'pikachu-plush' } }; } };
};
try {
const { getPublicProduct } = await import('../src/services/catalog-service.js');
assert.deepEqual(await getPublicProduct('pikachu-plush'), { slug: 'pikachu-plush' });
} finally {
globalThis.fetch = originalFetch;
}
});