feat: add public product detail web flow
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user