也许设置不佳,但是我从阅读的第一个TDD book中中学到了一些东西。
是否有可能会有一个大型的RTL functional.test.tsx
基本上贯穿用户故事,从而触发了许多其他测试和/或命令?
具体说来是可行还是理想:
functional.test.tsx:
import React from 'react'
import { render, fireEvent, screen } from '../testUtils'
import { Home } from '../../pages/index'
import '@testing-library/jest-dom/extend-expect'
//TDD Books: User Story
describe('Home page', () => {
//Bob logs into TDD Books using Google (or Github).
test('login works', () => {
*** run: cypress run --spec "cypress/integration/login.js" ***
expect(cypress_login).toBe('passed')
})
//Bob can see either his book shelf he added from earlier or it's empty waiting for books to be added.
...
我之所以如此,是因为NextAuth.js recommends使用赛普拉斯来测试社交登录。