Skip to content

Conversation

@hoangsonww
Copy link
Member

PR #2 - feat(api): fix tests to reflect new logic

Fix test suite to reflect the new backend API logic.

@hoangsonww hoangsonww requested a review from Copilot June 3, 2025 01:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates several test suites to align with the revised backend API logic by adjusting expected record counts, simplifying test data setup, and modifying assertion structures.

  • Updated CSV parser tests to reflect additional path entries and removed detailed path assertions.
  • Normalized string quoting and trimmed down expected Case object assertions in service layer tests.
  • Consolidated DisplayConfig instantiation and adjusted expected JSON manipulation in controller tests.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/user/utils/csv_parser_test.py Adjusted expected path counts and removed detailed checks.
tests/cases/service/case_service_test.py Switched single to double quotes, simplified importantInfos assertions.
tests/cases/controller/case_controller_test.py Streamlined DisplayConfig creation, inline-adjusted expected JSON.
Comments suppressed due to low confidence (3)

tests/user/utils/csv_parser_test.py:91

  • This assertion only checks the number of results after collapsing duplicates. Consider adding assertions for user_email, case_id, and specific path_config contents to ensure each entry is correctly formed.
assert len(result) == 2

tests/user/utils/csv_parser_test.py:62

  • The test is named test_should_ignore_none_config but now expects 3 path entries, including a row with no style flags. If the intent remains to ignore rows with all None style values, this should assert 2 instead of 3, or rename the test to match the new behavior.
assert len(result[0].path_config) == 3

tests/user/utils/csv_parser_test.py:77

  • In test_should_ignore_none_config_while_keep_user_case_relationship, the test originally expected zero path entries for a row without style flags. Verify whether the parser should produce an entry with default style or none at all; adjust the expected value or parser behavior accordingly.
assert len(result[0].path_config) == 1

Comment on lines +53 to +56
expected = expected_json()
expected["details"][0]["values"][1]["values"] = []
expected["details"][0]["values"][2]["values"] = []

Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Inline modification of the loaded JSON fixture reduces readability and makes the test harder to maintain. Consider updating the golden file itself or applying a small helper to strip values, so the expected structure is clear at a glance.

Suggested change
expected = expected_json()
expected["details"][0]["values"][1]["values"] = []
expected["details"][0]["values"][2]["values"] = []
expected = preprocess_expected_json(expected_json())

Copilot uses AI. Check for mistakes.
@hoangsonww hoangsonww merged commit 99e3ff5 into main Jun 3, 2025
6 checks passed
@hoangsonww hoangsonww self-assigned this Jun 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants