import 'package:flutter_test/flutter_test.dart';
import 'package:social_app/core/api/api_exception.dart';

void main() {
  group('ApiException', () {
    test('creates from DioException with 400 status', () {
      final dioException = Exception('Bad request');
      final apiException = ApiException.fromDioError(dioException);

      expect(apiException, isA<ApiException>());
      expect(apiException.message, contains('网络错误'));
    });

    test('UnauthorizedException has default message', () {
      const exception = UnauthorizedException();
      expect(exception.message, '请重新登录');
    });
  });
}
