Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/actions/__tests__/importText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@
expect(values).toEqual(['y', 'A', '', 'B', '', 'C'])
})

it('set cursor correctly after duplicate merge', () => {
it('importing a normal thought that duplicates a sibling keeps both (no merge)', () => {
const text = '- a\n - b'

const stateNew = reducerFlow([
Expand All @@ -826,8 +826,28 @@

const exported = exportContext(stateNew, [HOME_TOKEN], 'text/plain')

expect(exported).toBe(`- ${HOME_TOKEN}

Check failure on line 829 in src/actions/__tests__/importText.ts

View workflow job for this annotation

GitHub Actions / TDD — Unit tests

[unit] src/actions/__tests__/importText.ts > importing a normal thought that duplicates a sibling keeps both (no merge)

AssertionError: expected '- __ROOT__\n - a\n - b' to be '- __ROOT__\n - a\n - a\n - b' // Object.is equality - Expected + Received - __ROOT__ - a - - a - b ❯ src/actions/__tests__/importText.ts:829:20
- a
- a
- b`)
})

it('importing a metaprogramming attribute that duplicates a sibling merges hierarchically', () => {
const text = '- =a\n - b'

const stateNew = reducerFlow([
newThought('=a'),
newThought(''),
importTextAtFirstMatch({
at: [''],
text,
}),
])(initialState())

const exported = exportContext(stateNew, [HOME_TOKEN], 'text/plain')

expect(exported).toBe(`- ${HOME_TOKEN}
- =a
- b`)
})

Expand Down
Loading
Loading