<commit_before>require 'test_helper'

class Api::DetailedGuidePresenterTest < PresenterTestCase
  setup do
    @guide = stub_edition(:detailed_guide)
    @guide.stubs(:images).returns([])
    @guide.stubs(:organisations).returns([])
    @guide.stubs(:published_related_detailed_guides).returns([])
    @presenter = Api::DetailedGuidePresenter.decorate(@guide)
    stubs_helper_method(:params).returns(format: :json)
  end

  test ".paginate returns a decorated page of results" do
    stubs_helper_method(:params).returns(page: 1)
    page = stub('page')
    decorated_results = stub('decorated-results')
    Api::DetailedGuidePresenter::Paginator.stubs(:paginate).with([@guide], page: 1).returns(page)
    Api::DetailedGuidePresenter.stubs(:decorate).with(page).returns(decorated_results)
    assert_equal Api::DetailedGuidePresenter.paginate([@guide]), Api::DetailedGuidePresenter::PagePresenter.new(decorated_results)
  end

  test "json includes document title" do
    @guide.stubs(:title).returns('guide-title')
    assert_equal 'guide-title', @presenter.as_json[:title]
  end

  test "json includes the public API url as id" do
    Whitehall.stubs(:public_host_for).returns('govuk.example.com')
    assert_equal api_detailed_guide_url(@guide.document, host: 'govuk.example.com'), @presenter.as_json[:id]
  end

  test "json includes public guide url as web_url" do
    Whitehall.stubs(:public_host_for).returns('govuk.example.com')
    assert_equal detailed_guide_url(@guide.document, host: 'govuk.example.com'), @presenter.as_json[:web_url]
  end

  test "json includes the document body (without govspeak wrapper div) as html" do
    @guide.stubs(:body).returns("govspeak-body")
    assert_equal '<p>govspeak-body</p>', @presenter.as_json[:details][:body]
  end

  test "json includes absolute URLs for attachments referenced in the body" do

  end
<commit_msg>Remove accidentally-added empty test.<commit_after>require 'test_helper'

class Api::DetailedGuidePresenterTest < PresenterTestCase
  setup do
    @guide = stub_edition(:detailed_guide)
    @guide.stubs(:images).returns([])
    @guide.stubs(:organisations).returns([])
    @guide.stubs(:published_related_detailed_guides).returns([])
    @presenter = Api::DetailedGuidePresenter.decorate(@guide)
    stubs_helper_method(:params).returns(format: :json)
  end

  test ".paginate returns a decorated page of results" do
    stubs_helper_method(:params).returns(page: 1)
    page = stub('page')
    decorated_results = stub('decorated-results')
    Api::DetailedGuidePresenter::Paginator.stubs(:paginate).with([@guide], page: 1).returns(page)
    Api::DetailedGuidePresenter.stubs(:decorate).with(page).returns(decorated_results)
    assert_equal Api::DetailedGuidePresenter.paginate([@guide]), Api::DetailedGuidePresenter::PagePresenter.new(decorated_results)
  end

  test "json includes document title" do
    @guide.stubs(:title).returns('guide-title')
    assert_equal 'guide-title', @presenter.as_json[:title]
  end

  test "json includes the public API url as id" do
    Whitehall.stubs(:public_host_for).returns('govuk.example.com')
    assert_equal api_detailed_guide_url(@guide.document, host: 'govuk.example.com'), @presenter.as_json[:id]
  end

  test "json includes public guide url as web_url" do
    Whitehall.stubs(:public_host_for).returns('govuk.example.com')
    assert_equal detailed_guide_url(@guide.document, host: 'govuk.example.com'), @presenter.as_json[:web_url]
  end

  test "json includes the document body (without govspeak wrapper div) as html" do
    @guide.stubs(:body).returns("govspeak-body")
    assert_equal '<p>govspeak-body</p>', @presenter.as_json[:details][:body]
  end

{'fraction_non_alphanumeric': 0.13115646258503402, 'fraction_numerical': 0.0010884353741496598, 'mean_word_length': 5.671506352087114, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4436342', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1170, 'n_words': 220}