Skip to content

User Analytics API returns inconsistent data types & static month-based assertions cause test failures #627

@idehen-divine

Description

@idehen-divine

The user-analytics API returns monetary values as strings instead of floats, which causes assertion failures in tests. Additionally, the test expects static month-based values, making it unreliable across different months.

Steps to Reproduce:

  1. Run the test at different times of the year.
  2. The test expects hardcoded values for Jul and Aug, while Carbon::now()->subMonth() makes the expected values dynamic.
  3. The API returns amounts as "2000.00" (string) instead of 2000.00 (float), leading to assertion mismatches.

Expected Behavior:

The API should return monetary values as floats to ensure type consistency.
Tests should dynamically determine expected months based on the current date.

Actual Behavior:

The API response includes strings for numerical values.
The test fails when run in a different month due to hardcoded expectations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions