import 'dart:convert';

import 'package:gametime_server/api/router.dart';
import 'package:shelf/shelf.dart';
import 'package:test/test.dart';

void main() {
  test('GET /health returns ok status', () async {
    final handler = buildApiHandler();
    final response = await handler(
      Request('GET', Uri.parse('http://localhost/health')),
    );

    expect(response.statusCode, 200);
    expect(response.headers['content-type'], contains('application/json'));
    expect(jsonDecode(await response.readAsString()), {'status': 'ok'});
  });
}
