Skip to content

No unit tests exist for API and views #15

@Aypak

Description

@Aypak

Observed behavior

No unit tests exist for the neither the application's API nor views. This implies that testing needs to be done manually whenever a change is made, which can be both time consuming and prone to human error.

Suggested Solution

Create unit tests for all static pages on the portal, and API for endpoints that do not depend on the database.
Static pages include:

  • Home page
  • Index of topics
  • Grade 7 revision
  • Literacy tests
  • Numeracy tests
  • External evaluations
  • Coach dashboard

API endpoints that do not depend on the database include:

  • get_server_date

Requirements

  • The unit tests should basically test that the right content type and status code are returned from each of the concerned pages and endpoints.
  • The tests should be runnable via npm e.g npm test
  • A recommended approach is to use mocha, supertest and should

Future work

A test suite can be set up to bring up and tear down a database containing a known number of users, test_responses etc. This can then be used to unit test all of the other API endpoints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions