Files
tolaria/src/components/ConflictNoteBanner.test.tsx
lucaronin caa81ae96b feat: handle git divergence, conflicts, and manual pull from within Laputa
When push is rejected due to remote having newer commits, the bottom bar
now shows "Pull required" (orange). Clicking it pulls then auto-pushes.
Conflicted notes show an inline banner with "Keep mine" / "Keep theirs"
buttons. A new "Pull from Remote" command is available in Cmd+K and the
Vault menu. Clicking the sync badge opens a popup showing branch name,
ahead/behind counts, and a Pull button.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 09:51:06 +01:00

30 lines
1.2 KiB
TypeScript

import { describe, it, expect, vi } from 'vitest'
import { render, screen, fireEvent } from '@testing-library/react'
import { ConflictNoteBanner } from './ConflictNoteBanner'
describe('ConflictNoteBanner', () => {
it('renders conflict message', () => {
render(<ConflictNoteBanner onKeepMine={vi.fn()} onKeepTheirs={vi.fn()} />)
expect(screen.getByText('This note has a merge conflict')).toBeInTheDocument()
})
it('calls onKeepMine when clicking Keep mine button', () => {
const onKeepMine = vi.fn()
render(<ConflictNoteBanner onKeepMine={onKeepMine} onKeepTheirs={vi.fn()} />)
fireEvent.click(screen.getByTestId('conflict-keep-mine-btn'))
expect(onKeepMine).toHaveBeenCalledOnce()
})
it('calls onKeepTheirs when clicking Keep theirs button', () => {
const onKeepTheirs = vi.fn()
render(<ConflictNoteBanner onKeepMine={vi.fn()} onKeepTheirs={onKeepTheirs} />)
fireEvent.click(screen.getByTestId('conflict-keep-theirs-btn'))
expect(onKeepTheirs).toHaveBeenCalledOnce()
})
it('has the correct test id', () => {
render(<ConflictNoteBanner onKeepMine={vi.fn()} onKeepTheirs={vi.fn()} />)
expect(screen.getByTestId('conflict-note-banner')).toBeInTheDocument()
})
})