Spaces:
Sleeping
Sleeping
Download phd-advisor-frontend/src/utils/authStorage.test.js from BrainForge/HealthyEatingAdvisor: direct link, hf CLI and curl.
- Browser
- Download file 700 Bytes
-
https://huggingface.co/spaces/BrainForge/HealthyEatingAdvisor/resolve/main/phd-advisor-frontend/src/utils/authStorage.test.js
- Command line
-
hf download hf://spaces/BrainForge/HealthyEatingAdvisor/phd-advisor-frontend/src/utils/authStorage.test.js
-
curl -L -o authStorage.test.js https://huggingface.co/spaces/BrainForge/HealthyEatingAdvisor/resolve/main/phd-advisor-frontend/src/utils/authStorage.test.js
700 Bytes
| import { formatApiDetail } from './authStorage'; | |
| describe('formatApiDetail', () => { | |
| test('returns string details as-is', () => { | |
| expect(formatApiDetail('No account found for this email.', 'fallback')) | |
| .toBe('No account found for this email.'); | |
| }); | |
| test('flattens FastAPI validation lists', () => { | |
| const detail = [ | |
| { loc: ['body', 'email'], msg: 'value is not a valid email address' }, | |
| ]; | |
| expect(formatApiDetail(detail, 'fallback')).toMatch(/email/i); | |
| expect(formatApiDetail(detail, 'fallback')).toMatch(/valid email/i); | |
| }); | |
| test('uses fallback for empty detail', () => { | |
| expect(formatApiDetail(null, 'Login failed')).toBe('Login failed'); | |
| }); | |
| }); | |