Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

578 B
Raw Blame
import { getSlaState } from './SlaDisplay'

describe('getSlaState', () => {
    beforeEach(() => {
        jest.useFakeTimers().setSystemTime(new Date('2026-08-11T12:00:00Z'))
    })

    afterEach(() => {
        jest.useRealTimers()
    })

    it.each([
        ['breached', '2026-08-11T11:59:00Z', 'breached'],
        ['at risk', '2026-08-11T12:30:00Z', 'at-risk'],
        ['on track', '2026-08-11T13:00:00Z', 'on-track'],
    ])('returns %s for an SLA due at %s', (_label, slaDueAt, expectedState) => {
        expect(getSlaState(slaDueAt)).toBe(expectedState)
    })
})