Skip to content

Commit

Permalink
refactor: remove unused count function
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHulme committed Nov 10, 2023
1 parent 36a38eb commit eae71ff
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions app/javascript/test_support/mock_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ Mock the devour api to allow us to test the UI without making real requests to
the server. This is done by adding a mock middleware to the devour api. The
mock middleware intercepts requests and returns a mocked response. The mocked
response is defined by calling mockGet() or mockFail() on the mock middleware.
The mock middleware also keeps track of how many times a mocked request has
been called. This allows us to test that the UI is making the correct number
of requests.
*/

import devourApi from 'shared/devourApi'
Expand Down Expand Up @@ -67,7 +63,6 @@ const mockApi = function (resources = sequencescapeResources) {
const mockedRequest = findRequest(incomingRequest)

if (mockedRequest) {
mockedRequest.called += 1
incomingRequest.adapter = function () {
return mockedRequest.res
}
Expand All @@ -85,14 +80,12 @@ const mockApi = function (resources = sequencescapeResources) {
mockedRequests.unshift({
req: { method: 'GET', url: `${dummyApiUrl}/${url}`, data: {}, params }, // Request
res: Promise.resolve({ data: response }), // Response
called: 0,
})
},
mockFail: (url, params, response) => {
mockedRequests.unshift({
req: { method: 'GET', url: `${dummyApiUrl}/${url}`, data: {}, params }, // Request
res: Promise.reject({ data: response }), // Response
called: 0,
})
},
devour,
Expand Down

0 comments on commit eae71ff

Please sign in to comment.