import { describe, expect, it } from 'vitest'; import { failureCause } from './glossary'; describe('failure causes', () => { it('keeps the pod or network apart from a slow page, and neither is a product defect', () => { expect(failureCause('environment')).toEqual({ words: 'Environment problem (pod or network)', tone: 'mint', side: 'testing' }); expect(failureCause('timing').words).toMatch(/^Timing/); expect(failureCause('timing').words).not.toMatch(/environment/i); expect(failureCause('timing').tone).not.toBe(failureCause('environment').tone); expect(failureCause('real_defect').side).toBe('product'); }); it('says the cause is not clear for a missing or unknown category', () => { expect(failureCause(null).words).toBe('Cause not clear yet'); expect(failureCause('something_new').side).toBe('unknown'); }); });