Sha256: 044d24324432299d17d9ec416bfe325f8f246ac99add25e1fdb948cf9924452b

Contents?: true

Size: 946 Bytes

Versions: 44

Compression:

Stored size: 946 Bytes

Contents

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

44 entries across 44 versions & 1 rubygems

Version Path
govspeak-8.7.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.6.1 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.6.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.5.1 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.5.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.4.1 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.4.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.3.4 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.3.3 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.3.2 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.3.1 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.3.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.2.1 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.2.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.1.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.0.1 test/govspeak_extract_contact_content_ids_test.rb
govspeak-8.0.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-7.1.1 test/govspeak_extract_contact_content_ids_test.rb
govspeak-7.1.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-7.0.2 test/govspeak_extract_contact_content_ids_test.rb