branhoff / hooter-the-tutor

0 stars 2 forks source link

Add edge case unit tests for leetcode module #15

Open branhoff opened 1 month ago

branhoff commented 1 month ago

We need to improve our test coverage for the LeetCode module by adding unit tests for various edge cases. This will help ensure the robustness of our command under different scenarios.

Tasks:

  1. Add a test for empty username input
  2. Add a test for very long usernames
  3. Add a test for usernames with special characters
  4. Add a test for when the API returns unexpected data formats

For each test, follow the established pattern:

Example structure for each test:

@pytest.mark.asyncio
async def test_leetcode_[scenario_name](cog):
    ctx = AsyncMock()
    username = [appropriate_test_username]

    with patch.object(cog, 'fetch_leetcode_profile') as mock_fetch:
        mock_fetch.return_value = [appropriate_mock_return]

        await cog.leetcode.callback(cog, ctx, username)

        # Assert expected behavior

Definition of Done: