<commit_before>require "test_helper"
require "gds_api/test_helpers/publishing_api"

class ContentItemSyncerTest < ActiveSupport::TestCase
  include GdsApi::TestHelpers::PublishingApi

  setup do
    load_path = fixture_file("smart_answer_flows")
    SmartAnswer::FlowRegistry.stubs(:instance).returns(stub("Flow registry", find: @flow, load_path: load_path))
  end

  context "#sync" do
    setup do
      start_page_content_id = SecureRandom.uuid
      flow_content_id = SecureRandom.uuid
      @start_page_draft_request = stub_publishing_api_put_content(start_page_content_id, {})
      @start_page_publishing_request = stub_publishing_api_publish(start_page_content_id, {})
      @flow_draft_request = stub_publishing_api_put_content(flow_content_id, {})
      @flow_publishing_request = stub_publishing_api_publish(flow_content_id, {})
      @flow = stub("flow",
                   name: "bridge-of-death",
                   start_page_content_id: start_page_content_id,
                   flow_content_id: flow_content_id,
                   external_related_links: nil,
                   nodes: [])
    end

    should "create a preview for a draft smart answer" do
      @flow.stubs(:status).returns(:draft)
      presenter = FlowRegistrationPresenter.new(@flow)
      ContentItemSyncer.new.sync([presenter])

      assert_requested @start_page_draft_request
      assert_not_requested @start_page_publishing_request
      assert_requested @flow_draft_request
      assert_not_requested @flow_publishing_request
    end

    should "publish a published smart answer" do
      @flow.stubs(:status).returns(:published)
      presenter = FlowRegistrationPresenter.new(@flow)
      ContentItemSyncer.new.sync([presenter])

      assert_requested @start_page_draft_request
      assert_requested @start_page_publishing_request
      assert_requested @flow_draft_request
      assert_requested @flow_publishing_request
    end
  end
end
<commit_msg>Remove unused argument<commit_after>require "test_helper"
require "gds_api/test_helpers/publishing_api"

class ContentItemSyncerTest < ActiveSupport::TestCase
  include GdsApi::TestHelpers::PublishingApi

  setup do
    load_path = fixture_file("smart_answer_flows")
    SmartAnswer::FlowRegistry.stubs(:instance).returns(stub("Flow registry", load_path: load_path))
  end

  context "#sync" do
    setup do
      start_page_content_id = SecureRandom.uuid
      flow_content_id = SecureRandom.uuid
      @start_page_draft_request = stub_publishing_api_put_content(start_page_content_id, {})
      @start_page_publishing_request = stub_publishing_api_publish(start_page_content_id, {})
      @flow_draft_request = stub_publishing_api_put_content(flow_content_id, {})
      @flow_publishing_request = stub_publishing_api_publish(flow_content_id, {})
      @flow = stub("flow",
                   name: "bridge-of-death",
                   start_page_content_id: start_page_content_id,
                   flow_content_id: flow_content_id,
                   external_related_links: nil,
                   nodes: [])
    end

    should "create a preview for a draft smart answer" do
      @flow.stubs(:status).returns(:draft)
      presenter = FlowRegistrationPresenter.new(@flow)
      ContentItemSyncer.new.sync([presenter])

      assert_requested @start_page_draft_request
      assert_not_requested @start_page_publishing_request
      assert_requested @flow_draft_request
      assert_not_requested @flow_publishing_request
    end

    should "publish a published smart answer" do
      @flow.stubs(:status).returns(:published)
      presenter = FlowRegistrationPresenter.new(@flow)
      ContentItemSyncer.new.sync([presenter])

      assert_requested @start_page_draft_request
      assert_requested @start_page_publishing_request
      assert_requested @flow_draft_request
      assert_requested @flow_publishing_request
    end
  end
end

{'fraction_non_alphanumeric': 0.07512820512820513, 'fraction_numerical': 0.0, 'mean_word_length': 3.894604767879548, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4884071', 'n_tokens_mistral': 1168, 'n_tokens_neox': 1149, 'n_words': 188}