Skip to content

Create Quiz API request handlers #99

@pfwd

Description

@pfwd

This can only be done when #65 and #98 are complete.
To do

  • create a folder in src/api called requestHandler
  • Create src/api/requests/quiz.ts

This request handler must have two public methods

  • getAll
  • getQuiz

getAll

  • Makes API call to /api/v1/quizzes
  • Returns JSON

getQuiz

  • Makes API call to /api/v1/quiz/:id
  • Takes an integer as an :id
  • Returns JSON

Acceptance criteria

  • API getAll can be for-filled
  • API getQuiz can be for-filled
  • Unit tests have been added

TS ref for mocking axios request https://www.csrhymes.com/2022/03/09/mocking-axios-with-jest-and-typescript.html

Testing notes
Two types of tests are needed.

  1. Unit tests
  • Mocking out Axios get calls
  1. Integration tests (Not to be added in this ticket)
  • Testing the JSONServer setup

Metadata

Metadata

Assignees

Labels

api clientAny thing to do with the API ClientenhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions