Sha256: 7234bf4d7917ddbbee529721ded7db05ae4d133b3982b363445976f26b42bc3e

Contents?: true

Size: 965 Bytes

Versions: 13

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

13 entries across 13 versions & 1 rubygems

Version Path
govspeak-6.5.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-6.4.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-6.3.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-6.2.1 test/govspeak_extract_contact_content_ids_test.rb
govspeak-6.2.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-6.1.1 test/govspeak_extract_contact_content_ids_test.rb
govspeak-6.1.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-6.0.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-5.9.1 test/govspeak_extract_contact_content_ids_test.rb
govspeak-5.9.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-5.8.0 test/govspeak_extract_contact_content_ids_test.rb
govspeak-5.7.1 test/govspeak_extract_contact_content_ids_test.rb
govspeak-5.7.0 test/govspeak_extract_contact_content_ids_test.rb