import { describe, expect, it, vi } from 'vitest'
import { demoDataService } from '../DemoDataService'

describe('demoDataService', () => {
  it('adds notification entries', async () => {
    vi.useFakeTimers()
    vi.setSystemTime(new Date('2026-02-10T00:00:00Z'))

    const originalLength = (await demoDataService.getNotifications()).length
    const created = await demoDataService.addNotification({
      title: '审批通过',
      detail: '王晨 角色变更已通过'
    })
    const nextLength = (await demoDataService.getNotifications()).length

    expect(nextLength).toBe(originalLength + 1)
    expect(created.title).toBe('审批通过')
    expect(created.read).toBe(false)

    vi.useRealTimers()
  })
})
