<commit_before>require "test_helper"

class ConnectionsBuilderTest < ActiveSupport::TestCase
  setup do
    @organization = organizations(:ets)
    @provider = ConnectionsProviders::MembershipProvider.new
  end

  test "#call replaces the members" do
    ConnectionsBuilder.new(
      @organization,
      [users(:henry).email, users(:clement).email],
      provider: @provider,
    ).call

    assert_equal 3, @organization.memberships.size
    assert_equal ["<EMAIL>", "<EMAIL>", "<EMAIL>"],
      @organization.users.pluck(:email).sort
  end

  test "#call append the organization owner" do
    ConnectionsBuilder.new(
      @organization,
      [],
      provider: @provider,
    ).call(include_owner: true)

    assert_equal 1, @organization.memberships.size
    assert_equal "<EMAIL>",
      @organization.users.first.email
  end
end<commit_msg>Fix broken test for connection builder<commit_after>require "test_helper"

class ConnectionsBuilderTest < ActiveSupport::TestCase
  setup do
    @organization = organizations(:ets)
    @provider = ConnectionsProviders::MembershipProvider.new
    @service = ConnectionsBuilder.new(
      @organization,
      [users(:henry).email, users(:clement).email],
      provider: @provider,
    )
  end

  test "#call replaces the members" do
    @organization.memberships = @service.call

    assert_equal 2, @organization.memberships.size
    assert_equal ["<EMAIL>", "<EMAIL>"],
      @organization.users.pluck(:email).sort
  end

  test "#call append the organization owner" do
    @organization.memberships = @service.call(
      include_owner: true,
    )

    assert_equal 3, @organization.memberships.size
    assert_equal ["<EMAIL>", "<EMAIL>", "<EMAIL>"],
      @organization.users.pluck(:email).sort
  end
end
{'fraction_non_alphanumeric': 0.12038614423622941, 'fraction_numerical': 0.002271436683702442, 'mean_word_length': 3.840659340659341, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 12, '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': '4547588', 'n_tokens_mistral': 534, 'n_tokens_neox': 499, 'n_words': 115}