Skip to content

Commit bfd29e2

Browse files
committed
test(api): Test 404 responses with different Store ID (from env) and same product
1 parent a9681f2 commit bfd29e2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/api/tests/index.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,15 @@ test('Read product and typecheck SKU', async () => {
1616
expect(data.sku).toBeTypeOf('string');
1717
expect(data._id).toBe(productId);
1818
});
19+
20+
test('404 with different Store ID from env', async () => {
21+
process.env.ECOM_STORE_ID = '1011';
22+
try {
23+
const { data } = await api.get(`products/${productId}`);
24+
console.log(data);
25+
throw new Error('Should have thrown not found');
26+
} catch (error: any) {
27+
expect(error.statusCode).toBe(404);
28+
expect(error.response?.status).toBe(404);
29+
}
30+
});

0 commit comments

Comments
 (0)