Skip to content

Commit

Permalink
test(@dpc-sdp/ripple-tide-search): stubbed search autocomplete requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdowdle committed Jul 12, 2023
1 parent 4ff7d18 commit 22d5439
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Search listing - Aggregations

Background:
Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200
And the search autocomplete request is stubbed
And I am using a "macbook-16" device

@mockserver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Searching listing - Errors

Background:
Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200
And the search autocomplete request is stubbed
And I am using a "macbook-16" device

@mockserver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Grants collection

Background:
Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200
And the search autocomplete request is stubbed
And I am using a "macbook-16" device

@mockserver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Grid collection

Background:
Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200
And the search autocomplete request is stubbed
And I am using a "macbook-16" device

@mockserver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Searching listing - Pagination

Background:
Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200
And the search autocomplete request is stubbed
And I am using a "macbook-16" device

@mockserver
Expand Down
18 changes: 18 additions & 0 deletions packages/ripple-test-utils/step_definitions/common/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@ Given(
}
)

Given('the search autocomplete request is stubbed', () => {
cy.intercept(
'POST',
`/api/tide/search/${Cypress.env('searchIndex')}/query_suggestions`,
{
statusCode: status,
body: {
results: {
documents: []
},
meta: {
request_id: '123'
}
}
}
).as('autocompleteRequest') // assign an alias
})

Then(
'the search network request should be called with the {string} fixture',
(requestFixture: string) => {
Expand Down

0 comments on commit 22d5439

Please sign in to comment.