Skip to content

Commit 4111930

Browse files
committed
correctly testing for a search with no query
1 parent 940b731 commit 4111930

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

cypress/e2e/home.cy.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ describe('Navigating to the home page', () => {
33
let loading
44
let error
55
let featuredServices
6+
let requestURL
7+
let data
68

79
beforeEach(() => {
810
cy.customApiIntercept({
@@ -25,7 +27,23 @@ describe('Navigating to the home page', () => {
2527
})
2628
})
2729

28-
it('able to navigate to "/browse" with a blank query', () => {
30+
context('able to navigate to "/browse"', () => {
31+
const testSetup = ({ data, requestURL }) => {
32+
cy.customApiIntercept({
33+
action: 'GET',
34+
alias: 'useFilteredWares',
35+
requestURL,
36+
data,
37+
defaultFixture: 'services/wares.json',
38+
})
39+
}
40+
41+
it('with a blank query', () => {
42+
testSetup({
43+
requestURL: `/wares.json?per_page=${Cypress.env('API_PER_PAGE')}&q=`,
44+
data: true
45+
})
46+
2947
cy.get('button.search-button').click()
3048
cy.url().should('include', '/browse')
3149
cy.url().should('not.include', '?')

0 commit comments

Comments
 (0)