import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:feature_orders/feature_orders.dart';
import 'package:feature_orders/src/presentation/widgets/order_status_chip.dart';

void main() {
  Widget buildTestWidget(OrderStatus status) {
    return MaterialApp(
      theme: buildKcTheme(),
      home: Scaffold(body: OrderStatusChip(status: status)),
    );
  }

  group('OrderStatusChip', () {
    testWidgets('shows Pending label for pending status', (tester) async {
      await tester.pumpWidget(buildTestWidget(OrderStatus.pending));
      expect(find.text('Pending'), findsOneWidget);
    });

    testWidgets('shows Processing label for processing status', (tester) async {
      await tester.pumpWidget(buildTestWidget(OrderStatus.processing));
      expect(find.text('Processing'), findsOneWidget);
    });

    testWidgets('shows Shipped label for shipped status', (tester) async {
      await tester.pumpWidget(buildTestWidget(OrderStatus.shipped));
      expect(find.text('Shipped'), findsOneWidget);
    });

    testWidgets('shows Delivered label for delivered status', (tester) async {
      await tester.pumpWidget(buildTestWidget(OrderStatus.delivered));
      expect(find.text('Delivered'), findsOneWidget);
    });

    testWidgets('shows Cancelled label for cancelled status', (tester) async {
      await tester.pumpWidget(buildTestWidget(OrderStatus.cancelled));
      expect(find.text('Cancelled'), findsOneWidget);
    });
  });
}
