require 'test_helper'
require 'minitest/benchmark'

describe 'ImproveTypography::Base Benchmark' do
  let(:text) { '<div class="text_module__body"><p>Four Boxes, Krabbesholm Højskoles gallery, welcomes you to the exhibition "The Poor Connection" and book launch of the exhibiton catalouge "Poor and Needy" by Yvette Brackman and Lise Haller Baggesen.</p><p>Exhibition: 20th of October to 5th of November</p><p>Opening and book launch: 20th of October, 5PM</p><p>Opening hours: 11-15 on weekdays</p><p>Participating artist: Edra Soto, Sofia Leiby, Anni Holm, Matt Morris, Kurt Finsten, Ulla Hvejsel, Anja Franke, Jim Duignan, Josh Mittelman, Jenny Kendler, Christa Donner, Andrew Yang, Michelle Eistrup, Kirsten Leenaars, Henrik Plenge Jakobsen, Rashalya Marie Brown, Hannah Heilmann, Nanna Lysholt Hansen, Skovsnogen, Mobil Kultur Buro</p><p>The exhibition catalouge "Poor and Needy" is published by The Poor Farm and Krabbesholm.</p><p>Lise Haller Baggesen and Yvette Brackman introduce the exhibition:</p><p>Poor &amp; Needy started as an invitation from the artists, educators and curators Brad Killam and Michelle Grabner, about two years ago, to "do something " for the 2016 Great Poor Farm Experiment VIII, an art center and event in Manawa in rural Wisconsin. The exhibition and symposium that was Poor and Needy at The Poor Farm now arrives in Denmark as The Poor Connection at Krabbesholm Højskole, an important institution for aspiring artists, writers, and thinkers, situated in the heart of Jutland. The Poor Connection brings together artists from Scandinavia and the American Midwest, to strengthen and explore the connections between these two demographics and better understand their shared history and how they relate to the subjects of cooperation, migration, labor and debt.</p><p>The artist’s colony, because that is what both The Poor Farm and Krabbesholm are, is located somewhere between Utopia and a gated community; questions of exclusivity and inclusivity repeatedly come into play here. But at least, these are open-ended conversations, not the law. In addition to the exhibition we have produced an exhibition catalogue with texts and works from artists and writers that reflect upon the open-mindedness of our local and global communities.</p><p>Come one come all, it doesn’t say RSVP on the statue of Liberty; it does not say so on the gates of the art world either!</p></div>' }
  let(:result) { ImproveTypography::Base.call(text) }

  def self.bench_range
    [1, 100_000, 250_000]
  end

  bench_performance_constant 'call' do |n|
    n.times do
      result.must_include "<div class=\"text_module__body\">\n<p>Four Boxes, Krabbesholm Højskoles gallery, welcomes you to the exhibition “The Poor Connection” and book launch of the exhibiton catalouge “Poor and Needy” by Yvette Brackman and Lise Haller Baggesen.</p>\n<p>Exhibition: 20th of October to 5th of November</p>\n<p>Opening and book launch: 20th of October, 5PM</p>\n<p>Opening hours: 11-15 on weekdays</p>\n<p>Participating artist: Edra Soto, Sofia Leiby, Anni Holm, Matt Morris, Kurt Finsten, Ulla Hvejsel, Anja Franke, Jim Duignan, Josh Mittelman, Jenny Kendler, Christa Donner, Andrew Yang, Michelle Eistrup, Kirsten Leenaars, Henrik Plenge Jakobsen, Rashalya Marie Brown, Hannah Heilmann, Nanna Lysholt Hansen, Skovsnogen, Mobil Kultur Buro</p>\n<p>The exhibition catalouge “Poor and Needy” is published by The Poor Farm and Krabbesholm.</p>\n<p>Lise Haller Baggesen and Yvette Brackman introduce the exhibition:</p>\n<p>Poor &&nbsp;Needy started as an invitation from the artists, educators and curators Brad Killam and Michelle Grabner, about two years ago, to “do something ”&nbsp;for the 2016&nbsp;Great Poor Farm Experiment VIII, an art center and event in Manawa in rural Wisconsin. The exhibition and symposium that was Poor and Needy at The Poor Farm now arrives in Denmark as The Poor Connection at Krabbesholm Højskole, an important institution for aspiring artists, writers, and thinkers, situated in the heart of Jutland. The Poor Connection brings together artists from Scandinavia and the American Midwest, to strengthen and explore the connections between these two demographics and better understand their shared history and how they relate to the subjects of cooperation, migration, labor and debt.</p>\n<p>The artist’s colony, because that is what both The Poor Farm and Krabbesholm are, is located somewhere between Utopia and a&nbsp;gated community; questions of exclusivity and inclusivity repeatedly come into play here. But at least, these are open-ended conversations, not the law. In addition to the exhibition we have produced an exhibition catalogue with texts and works from artists and writers that reflect upon the open-mindedness of our local and global communities.</p>\n<p>Come one come all, it doesn’t say RSVP on the statue of Liberty; it does not say so on the gates of the art world either!</p>\n</div>"
    end
  end
end
