Files
cnd2025-hw3/backend/test/server.test.ts
yubintw 9df48062d4 init
2024-03-25 21:39:05 +08:00

18 lines
476 B
TypeScript

import { describe, expect, test } from 'vitest'
import { serverOf } from '../src/server'
describe('Server Testing', () => {
const server = serverOf()
test('When send a GET request to /ping, it should return status code 200', async () => {
// act: send a GET request to /ping
const response = await server.inject({
method: 'GET',
url: '/ping'
})
// assert: response should be status code 200
expect(response.statusCode).toBe(200)
})
})