Slide 31
Slide 31 text
SUBCUTANEOUS FUNCTIONAL TEST
describe('Checkout', () => {
jest.mock('../httpClient', stubHttpClient)
it("allows a purchase after logging in", async () => {
expect.assertions(1);
const app = mount()
fillIn(app, '#search', 'iPhone 8')
await httpReturns({name: 'iPhone 8', price: 899.99})
click(app, '#addToCart')
click(app, '#checkout')
fillIn(app, '#username', 'jane_doe')
await httpReturns({success: true})
expect(app).toHaveText('Thanks for your purchase, Jane!')
})
})