app.service.spec.tsβ’764 B
import { describe, it, expect, beforeEach } from 'vitest'
import { AppService } from './app.service'
describe('AppService', () => {
let service: AppService
beforeEach(() => {
service = new AppService()
})
describe('getHealth', () => {
it('should return health status', () => {
const result = service.getHealth()
expect(result).toHaveProperty('status', 'ok')
expect(result).toHaveProperty('timestamp')
expect(typeof result.timestamp).toBe('string')
})
it('should return valid ISO timestamp', () => {
const result = service.getHealth()
const timestamp = new Date(result.timestamp)
expect(timestamp).toBeInstanceOf(Date)
expect(timestamp.toISOString()).toBe(result.timestamp)
})
})
})