Expand unit and e2e coverage

This commit is contained in:
beatz174-bit committed 2025-11-23 16:58:36 +10:00
1 parent da58c6ae03
commit e9fdce5772
3 files changed
+71

No files matched your search

+23
View File
@@ -76,5 +76,28 @@ describe('fetchProductFromOFF', () => {
expect(result).toBeNull();
});
it('returns null immediately when the barcode is empty', async () => {
const result = await fetchProductFromOFF('');
expect(result).toBeNull();
});
it('returns null when the browser is offline', async () => {
const originalNavigator = navigator;
Object.defineProperty(globalThis, 'navigator', {
value: { onLine: false },
configurable: true,
});
const result = await fetchProductFromOFF('123456');
expect(result).toBeNull();
Object.defineProperty(globalThis, 'navigator', {
value: originalNavigator,
configurable: true,
});
});
});