require "test_helper"
require "elasticsearch/sitemap"

class SitemapGeneratorTest < MiniTest::Unit::TestCase
  def test_should_generate_sitemap
    sitemap = SitemapGenerator.new('')

    sitemap_xml = sitemap.generate_xml([ 'https://www.gov.uk/page', '/another-page', 'yet-another-page' ])
    doc = Nokogiri::XML(sitemap_xml)
    urls = doc.css('url > loc').map(&:inner_html)
    assert_equal urls[0], 'https://www.gov.uk/page'
    assert_equal urls[1], 'http://www.dev.gov.uk/another-page'
    assert_equal urls[2], 'http://www.dev.gov.uk/yet-another-page'
  end
end

Add basic test for sitemap generation
Add basic test for sitemap generation

Check to make sure both fully qualified urls and path only urls are
correctly handled when generating the sitemap.
