File: test_invalid_options.rb

package info (click to toggle)
ruby-jekyll-toc 0.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 244 kB
  • sloc: ruby: 912; makefile: 9
file content (36 lines) | stat: -rw-r--r-- 883 bytes parent folder | download
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
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

require 'test_helper'

class TestInvalidOptions < Minitest::Test
  BASE_HTML = '<h1>h1</h1>'
  EXPECTED_HTML = <<~HTML.chomp
    <ul id="toc" class="section-nav">
    <li class="toc-entry toc-h1"><a href="#h1">h1</a></li>
    </ul>
  HTML

  def test_option_is_nil
    parser = Jekyll::TableOfContents::Parser.new(BASE_HTML, nil)

    assert_equal(EXPECTED_HTML, parser.build_toc)
  end

  def test_option_is_epmty_string
    parser = Jekyll::TableOfContents::Parser.new(BASE_HTML, '')

    assert_equal(EXPECTED_HTML, parser.build_toc)
  end

  def test_option_is_string
    parser = Jekyll::TableOfContents::Parser.new(BASE_HTML, 'string')

    assert_equal(EXPECTED_HTML, parser.build_toc)
  end

  def test_option_is_array
    parser = Jekyll::TableOfContents::Parser.new(BASE_HTML, [])

    assert_equal(EXPECTED_HTML, parser.build_toc)
  end
end