From 8de2333ee16b6935175796a4baf15ee31fd44c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Filipe?= Date: Wed, 18 Dec 2024 23:17:14 -0300 Subject: [PATCH] Test(fga-eps-mds/2024.2-ARANDU-DOC#59): apagar alguns teste desnecessarios --- test/ui/Shared/OrDivider_test.dart | 21 ------------- test/ui/Shared/TextAndLink_test.dart | 46 ---------------------------- test/ui/Shared/TitleSlogan_test.dart | 39 ----------------------- test/widget_test.dart | 30 ------------------ 4 files changed, 136 deletions(-) delete mode 100644 test/ui/Shared/OrDivider_test.dart delete mode 100644 test/ui/Shared/TextAndLink_test.dart delete mode 100644 test/ui/Shared/TitleSlogan_test.dart delete mode 100644 test/widget_test.dart diff --git a/test/ui/Shared/OrDivider_test.dart b/test/ui/Shared/OrDivider_test.dart deleted file mode 100644 index ef82362..0000000 --- a/test/ui/Shared/OrDivider_test.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:aranduapp/ui/shared/OrDivider.dart'; - -void main() { - testWidgets('Testa se o componente OrDivider é renderizado corretamente', - (WidgetTester tester) async { - // Monta o widget para teste - await tester.pumpWidget(const MaterialApp( - home: Scaffold( - body: OrDivider(), - ), - )); - - // Verifica se o widget contém dois Dividers - expect(find.byType(Divider), findsNWidgets(2)); - - // Verifica se o texto "ou" está presente - expect(find.text('ou'), findsOneWidget); - }); -} diff --git a/test/ui/Shared/TextAndLink_test.dart b/test/ui/Shared/TextAndLink_test.dart deleted file mode 100644 index 6457470..0000000 --- a/test/ui/Shared/TextAndLink_test.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:aranduapp/ui/shared/TextAndLink.dart'; - -void main() { - testWidgets('Testa o widget TextAndLink', (WidgetTester tester) async { - // Flag para verificar se a ação foi acionada corretamente - bool actionTriggered = false; - - // Função de callback para simular a ação quando o link é clicado - void mockAction() { - actionTriggered = true; - } - - // Dados para exibição no widget - const String text = "Não tem uma conta?"; - const String link = "Cadastre-se"; - - // Constrói o widget dentro de um ambiente MaterialApp - await tester.pumpWidget( - MaterialApp( - home: Scaffold( - body: TextAndLink( - text: text, - link: link, - action: mockAction, - ), - ), - ), - ); - - // Verifica se o texto principal e o link estão presentes na interface - expect(find.text(text), findsOneWidget); - expect( - find.text(' $link'), findsOneWidget); // Inclui o espaço antes do link - - // Simula o clique no link - final linkFinder = - find.text(' $link'); // Localiza o texto do link com o espaço - await tester.tap(linkFinder); - await tester.pump(); - - // Confirma que a função de ação foi chamada após o clique - expect(actionTriggered, isTrue); - }); -} diff --git a/test/ui/Shared/TitleSlogan_test.dart b/test/ui/Shared/TitleSlogan_test.dart deleted file mode 100644 index 9757077..0000000 --- a/test/ui/Shared/TitleSlogan_test.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:aranduapp/ui/shared/TitleSlogan.dart'; - -void main() { - testWidgets('Testa TitleSlogan', (WidgetTester tester) async { - await tester.pumpWidget( - const MaterialApp( - home: Scaffold( - body: TitleSlogan(), - ), - ), - ); - - // Verificar se o texto "Arandú" está presente - expect(find.text('Arandú'), findsOneWidget); - - // Verificar se o texto está usando o estilo correto - final textFinder = find.text('Arandú'); - final textWidget = tester.widget(textFinder); - final textStyle = textWidget.style; - - // Verificar se o texto usa a fonte "Amarante" do Google Fonts - expect(textStyle?.fontFamily, GoogleFonts.amarante().fontFamily); - - // Verificar se o círculo de fundo está presente - final circleFinder = find.byType(Container); - final containerWidget = tester.widget(circleFinder); - final decoration = containerWidget.decoration as BoxDecoration; - - // Verificar se o Container tem a forma de círculo - expect(decoration.shape, BoxShape.circle); - - // Verificar se a cor do fundo é a cor primária do tema - expect(decoration.color, - Theme.of(tester.element(find.byType(Scaffold))).colorScheme.primary); - }); -} diff --git a/test/widget_test.dart b/test/widget_test.dart deleted file mode 100644 index 975faa0..0000000 --- a/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility in the flutter_test package. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:aranduapp/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -}