Sha256: 18ebdbc45c979123e26a9706d60bbd4f5c3592cab6f9b3dfd40f0b6727614a6a

Contents?: true

Size: 965 Bytes

Versions: 4

Compression:

Stored size: 965 Bytes

Contents

# encoding: UTF-8

require "test_helper"

class GovspeakExtractContactContentIdsTest < Minitest::Test
  test "contact content ids can be extracted from govspeak" do
    content_id1 = SecureRandom.uuid
    content_id2 = SecureRandom.uuid
    govspeak = "Some text with a contact\n [Contact:#{content_id1}]\n\n[Contact:#{content_id2}]"

    assert_equal(Govspeak::Document.new(govspeak).extract_contact_content_ids, [content_id1, content_id2])
  end

  test "only extracts contact content ids that are UUIDs" do
    govspeak = "[Contact:12345]"

    refute_equal(
      Govspeak::Document.new(govspeak).extract_contact_content_ids,
      %w[12345],
    )
  end

  test "same contact repeated multiple times only yields a single result" do
    content_id = SecureRandom.uuid
    govspeak = "[Contact:#{content_id}]\n[Contact:#{content_id}][Contact:#{content_id}]"

    assert_equal(Govspeak::Document.new(govspeak).extract_contact_content_ids, [content_id])
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
govspeak-6.5.4 test/govspeak_extract_contact_content_ids_test.rb
govspeak-6.5.3 test/govspeak_extract_contact_content_ids_test.rb
govspeak-6.5.2 test/govspeak_extract_contact_content_ids_test.rb
govspeak-6.5.1 test/govspeak_extract_contact_content_ids_test.rb