Mock Network When Using Next.js getServerSideProps Call

1 · Gleb Bahmutov · Aug. 10, 2021, 1:30 p.m.
Cypress has a great way to spy or stub network calls the application makes. Just use the cy.intercept command and have the full control over Ajax calls and static resources. But sometimes, the application is making the network calls from the server-side call. For example, a Next.js application might use the getServerSideProps method to retrieve a joke to be shown to the user.pages/index.js12345678910111213141516171819202122232425262728import styles from './index.module.css'function HomePage({ jo...