import { describe, expect, test } from 'bun:test'; import React from 'react'; import { renderToStaticMarkup } from 'react-dom/server'; import type { EditorAPI } from '@/lib/api/types'; import { ApplyPatchFileButtons } from './ApplyPatchFileButtons'; import { openApplyPatchFileInEditor } from './applyPatchEditorAction'; const makePatch = (path: string, line: number, before: string, after: string) => [ `--- a/${path}`, `+++ b/${path}`, `@@ -${line} +${line} @@`, `-${before}`, `+${after}`, ].join('\n'); const files = [ { filePath: '/workspace/project/src/first.ts', relativePath: 'src/first.ts', patch: makePatch('src/first.ts', 4, 'first old', 'first new'), additions: 1, deletions: 1, type: 'update', }, { filePath: '/workspace/project/src/second.ts', relativePath: 'src/second.ts', patch: makePatch('src/second.ts', 12, 'second old', 'second new'), additions: 1, deletions: 1, type: 'update', }, ]; describe('ApplyPatchFileButtons', () => { test('renders one labeled button per non-deleted file', () => { const markup = renderToStaticMarkup( undefined} />, ); expect(markup.match(/