Skip to content

Commit

Permalink
add unit test for thought trim
Browse files Browse the repository at this point in the history
  • Loading branch information
RED-ROSE515 committed Oct 22, 2024
1 parent 4fb180d commit 53a301b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/e2e/puppeteer/__tests__/thought-trim.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import click from '../helpers/click'
import clickThought from '../helpers/clickThought'
import getEditingText from '../helpers/getEditingText'
import paste from '../helpers/paste'

vi.setConfig({ testTimeout: 20000, hookTimeout: 20000 })

it('when cursor is null, thought will be trimmed.', async () => {
const importText = `
- Don't stay awake for too long. `

await paste(importText)

await click('#content')
const editingText = await getEditingText()
expect(editingText).toBe(`Don't stay awake for too long.`)
})

it('when click the next thought, prev thought will be trimmed.', async () => {
const importText = `
- Don't stay awake for too long.
- I don't wanna fall asleep `

await paste(importText)

await clickThought(`I don't wanna fall asleep`)
await clickThought(`Don't stay awake for too long.`)
const editingText = await getEditingText()
expect(editingText).toBe(`Don't stay awake for too long.`)
})

0 comments on commit 53a301b

Please sign in to comment.