Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unittests for widget custom_list_tile.dart #1174

Closed
palisadoes opened this issue Jan 31, 2022 · 9 comments · Fixed by #1304
Closed

Unittests for widget custom_list_tile.dart #1174

palisadoes opened this issue Jan 31, 2022 · 9 comments · Fixed by #1304
Assignees
Labels
good first issue Good for newcomers test Testing application

Comments

@palisadoes
Copy link
Contributor

We will need unittests done for all methods, classes and functions found in this file.

Any widgets referenced in this file must also have unittests done

custom_list_tile.dart 

This file can be found in the lib/widgets directory

Parent Issue:

PR Acceptance Criteria

@palisadoes palisadoes added test Testing application points 01 labels Jan 31, 2022
@github-actions github-actions bot added parent The issue is generating more sub-issues unapproved Unapproved, needs to be triaged labels Jan 31, 2022
@palisadoes palisadoes added good first issue Good for newcomers and removed parent The issue is generating more sub-issues labels Jan 31, 2022
@ayushvrma
Copy link

hi, can I work on this issue?

@palisadoes palisadoes removed the unapproved Unapproved, needs to be triaged label Feb 2, 2022
@ayushvrma
Copy link

@palisadoes i can see that a test file for custom_list_tile.dart already exists via pr #1084 . What all can I do to improve on it?

@palisadoes
Copy link
Contributor Author

The code coverage for that file is only 90%, try to get to 100%.

@ayushvrma
Copy link

ayushvrma commented Feb 2, 2022

@Literal-Eval can you help me out a bit on this issue please?

orgInfo!.isPublic!
--
114 | ? AppLocalizations.of(context)!
115 | .strictTranslate('Public')

on how to cover this path of the code?

@ayushvrma
Copy link

@palisadoes can you help me out a bit?

testWidgets('Creating Custom List (giving custom options)', (tester) async {
      await tester.pumpWidget(createCustomListTileUser(
          type: TileType.option,
          option: Options(
              icon: const Icon(Icons.add),
              title: 'henlo',
              subtitle: 'yesh',
              trailingIconButton: null)));
      final Text text =
          tester.firstWidget(find.byKey(const Key('trailingIconButton')));
      expect(text.style!.getTextStyle(),
           equals(Theme.of(MockBuildContext()).textTheme.bodyText2));
    });

I'm writing this test so as to cover the path of TileType being option to cover 100% of the code but I'm getting back different types of TextSyles as expected. Could you help me out a bit?

@palisadoes
Copy link
Contributor Author

Sometimes the test exposes poor choices in the code. Your test may be correct, check the code to see where the issue could be.

@ayushvrma
Copy link

Tests for the user are done, but when the widget is built using TileType.org, it fails to build giving me improper errors, where can I find more information about orgs in Talawa, I've already looked up org_info.dart , so do I need to create a new org by myself to test this widget or is there another way? @palisadoes

@palisadoes
Copy link
Contributor Author

Please ask @ahluwaliatikant or @guptapriyanshu7 for assistance. They have extensive experience writing tests for the code base.

@ayushvrma ayushvrma removed their assignment Feb 23, 2022
@RandyKdev
Copy link

Hi @palisadoes, I would like to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers test Testing application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants