Files
AutoGPT/classic/frontend/test/user_message_tile_test.dart
Swifty ef7cfbb860 refactor: AutoGPT Platform Stealth Launch Repo Re-Org (#8113)
Restructuring the Repo to make it clear the difference between classic autogpt and the autogpt platform:
* Move the "classic" projects `autogpt`, `forge`, `frontend`, and `benchmark` into a `classic` folder
  * Also rename `autogpt` to `original_autogpt` for absolute clarity
* Rename `rnd/` to `autogpt_platform/`
  * `rnd/autogpt_builder` -> `autogpt_platform/frontend`
  * `rnd/autogpt_server` -> `autogpt_platform/backend`
* Adjust any paths accordingly
2024-09-20 16:50:43 +02:00

43 lines
1.3 KiB
Dart

import 'package:auto_gpt_flutter_client/views/chat/user_message_tile.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
// Test group for UserMessageTile widget
group('UserMessageTile', () {
// Test to check if the widget renders without error
testWidgets('renders without error', (WidgetTester tester) async {
await tester.pumpWidget(const MaterialApp(
home: Scaffold(
body: UserMessageTile(message: 'Hello, User!'),
),
));
expect(find.byType(UserMessageTile), findsOneWidget);
});
// Test to check if the widget displays the correct user message
testWidgets('displays the correct user message',
(WidgetTester tester) async {
const testMessage = 'Test Message';
await tester.pumpWidget(const MaterialApp(
home: Scaffold(
body: UserMessageTile(message: testMessage),
),
));
expect(find.text(testMessage), findsOneWidget);
});
// Test to check if the widget displays the "User" title
testWidgets('displays the "User" title', (WidgetTester tester) async {
await tester.pumpWidget(const MaterialApp(
home: Scaffold(
body: UserMessageTile(message: 'Any Message'),
),
));
expect(find.text('User'), findsOneWidget);
});
});
}