Page MenuHomePhabricator

AQS 2.0: Mediarequests: Implement Unit Tests
Closed, DuplicatePublic

Description

Implement unit tests for the Mediarequests services.

For comparison and reference, the existing AQS production unit tests can be found in analytics-aqs/test/features/mediarequests/mediarequests.js

Completion criteria: the following unit tests are implemented:

per file endpoint

  • should return 200 for expected parameters
  • should return 400 when per file parameters are wrong
  • should return the expected per file data after insertion
  • should return the expected all agent types per file data after insertion
  • should handle per file queries with encoded characters
  • should return data when start = timestamp = end and YYYYMMDD is used
  • should return the expected per file monthly data after insertion
  • should return the expected monthly data only for full months
  • should return 400 when there are no full months in specified date range

per referer aggregate endpoint

  • should return 200 for expected parameters
  • should return 400 when aggregate parameters are wrong
  • should return 400 when start is before end
  • should return 400 when timestamp is invalid
  • should return multiple hours inside a day

tops endpoint

  • should return 400 when tops parameters are wrong
  • should return 400 when all-year is used for the year parameter
  • should return 400 when all-months is used for the month parameter
  • should return 400 when tops date is invalid
  • should return the expected tops data after insertion, in rank order

Event Timeline