summaryrefslogtreecommitdiff
path: root/spec/lib/banzai/filter/normalize_source_filter_spec.rb
blob: 8eaeec0e7b00b1a9681d45dba1cdbbbcc66a290c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Banzai::Filter::NormalizeSourceFilter do
  include FilterSpecHelper

  it 'removes the UTF8 BOM from the beginning of the text' do
    content = "\xEF\xBB\xBF---"

    output = filter(content)

    expect(output).to match '---'
  end

  it 'does not remove those characters from anywhere else in the text' do
    content = <<~MD
      \xEF\xBB\xBF---
      \xEF\xBB\xBF---
    MD

    output = filter(content)

    expect(output).to match "---\n\xEF\xBB\xBF---\n"
  end
end