app.controller.spec.tsβ’756 B
import { describe, it, expect, beforeEach, vi } from 'vitest'
import { AppController } from './app.controller'
import { AppService } from './app.service'
describe('AppController', () => {
let controller: AppController
let service: AppService
beforeEach(() => {
service = new AppService()
controller = new AppController(service)
})
describe('getHealth', () => {
it('should return health status', () => {
const result = controller.getHealth()
expect(result).toHaveProperty('status')
expect(result).toHaveProperty('timestamp')
})
it('should call appService.getHealth', () => {
const spy = vi.spyOn(service, 'getHealth')
controller.getHealth()
expect(spy).toHaveBeenCalled()
})
})
})