Skip to content

Commit

Permalink
Test the inline diff parser
Browse files Browse the repository at this point in the history
  • Loading branch information
hellcp-work committed Oct 10, 2024
1 parent cf966ef commit b03cdf4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/api/spec/fixtures/files/diff_with_highlights.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@@ -1,1 +1,1 @@
-before
+befafterre
16 changes: 16 additions & 0 deletions src/api/spec/services/diff_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,21 @@
expect(subject.lines).to eq(result)
end
end

context 'diff with highlights' do
let(:file) { 'diff_with_highlights.diff' }

let(:result_array) do
[
["@@ -1,1 +1,1 @@\n", 'range', 1, nil, nil],
["-bef<span class=\"inline-diff\">o</span>re\n", 'removed', 2, 1, nil],
["+bef<span class=\"inline-diff\">after</span>re\n", 'added', 3, nil, 1]
]
end

it 'parses correctly' do
expect(subject.lines).to eq(result)
end
end
end
end

0 comments on commit b03cdf4

Please sign in to comment.