Skip to content

Commit 6f9d08a

Browse files
committed
a few more tests for the blog posts
1 parent 40395ab commit 6f9d08a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

examples/stubbing-spying__window-fetch/cypress/integration/stub-fetch-spec.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22
// @ts-check
33

44
describe('stubbing', function () {
5+
it('shows no Response message', () => {
6+
cy.visit('/', {
7+
onBeforeLoad (win) {
8+
cy.stub(win, 'fetch').withArgs('/favorite-fruits')
9+
.resolves({
10+
ok: true,
11+
json: () => [],
12+
})
13+
},
14+
})
15+
16+
cy.contains('No favorites').should('be.visible')
17+
})
18+
519
it('directly stubs window.fetch to test loading indicator', () => {
620
// stub the "fetch(/favorite-fruits)" call from the app
721
cy.visit('/', {
@@ -113,6 +127,7 @@ describe('stubbing', function () {
113127
url: '/favorite-fruits',
114128
status: 500,
115129
response: '',
130+
delay: 2000,
116131
headers: {
117132
'status-text': 'Orchard under maintenance',
118133
},

0 commit comments

Comments
 (0)