I have written a plumber API and exposed as a service. Now I want to write down the unit test case for all the API's.
Right now API's are doing the below functionality
- Connecting to the database and getting the data
- Grouping the data
- Using the ggplot to plot the graph with the given data.
I have few issue end up with
- I was not able to mock the database connection.
- How do we call the API function from the testthat? API's doesn't have name to call from testthat function file.
- All the API has request and response object how do we mock that? when I tried look into the request and response object it is printing as environment.
Kindly do the needful.