<commit_before>require 'spec_helper'

RSpec.describe GramToGoogleService, type: :service do

  let(:gram_account) {build(:gram_account_with_password)}

  it "initialize a service" do
    expect(GramToGoogleService.new(gram_account)).to be_a_kind_of(GramToGoogleService)
  end

  it "returns update attributes hash" do
    service=GramToGoogleService.new(gram_account)
    expected_hash={ :name=>{
        :given_name=>"Berniece",
        :family_name=>"Welch"
      },
      :password=>"<PASSWORD>",
      :hash_function=>"SHA-1",
      :primary_email=>"<EMAIL>",
      :external_ids=>[
        {:type=>"account", :value=>"bfd1c2a2-9876-41f8-8a6a-a7caaa7019e7"},
        {:type=>"custom", customType:"uuid", :value=>"bfd1c2a2-9876-41f8-8a6a-a7caaa7019e7"},
        {:type=>"organization", :value=>123489}
      ]
    }

    expect(service.to_hash).to eq(expected_hash)
  end

    it "returns a google user" do
    service=GramToGoogleService.new(gram_account)
    gu=service.to_google_user

    expect(gu.name).to eq({:given_name=>"Berniece", :family_name=>"Welch"})
    expect(gu.password).to eq("<PASSWORD>")
    expect(gu.hash_function).to eq("SHA-1")
    expect(gu.primary_email).to eq("<EMAIL>")
    expect(gu.external_ids).to match_array([{:type=>"account", :value=>"bfd1c2a2-9876-41f8-8a6a-a7caaa7019e7"}, {:type=>"custom", :customType=>"uuid", :value=>"bfd1c2a2-9876-41f8-8a6a-a7caaa7019e7"}, {:type=>"organization", :value=>123489}])<commit_msg>update tests<commit_after>require 'spec_helper'

RSpec.describe GramToGoogleService, type: :service do

  let(:gram_account) {build(:gram_account_with_password)}

  it "initialize a service" do
    expect(GramToGoogleService.new(gram_account)).to be_a_kind_of(GramToGoogleService)
  end

  it "returns update attributes hash" do
    service=GramToGoogleService.new(gram_account)
    expected_hash={ :name=>{
        :given_name=>"Berniece",
        :family_name=>"Welch"
      },
      :password=>"<PASSWORD>",
      :hash_function=>"SHA-1",
      :primary_email=>"<EMAIL>",
      :external_ids=>[
        {:type=>"custom", customType:"id_soce", :value=>123489},
        {:type=>"organization", :value=>"bfd1c2a2-9876-41f8-8a6a-a7caaa7019e7"},
      ]
    }

    expect(service.to_hash).to include(expected_hash)
  end

    it "returns a google user" do
    service=GramToGoogleService.new(gram_account)
    gu=service.to_google_user

    expect(gu.name).to eq({:given_name=>"Berniece", :family_name=>"Welch"})
    expect(gu.password).to eq("<PASSWORD>")
    expect(gu.hash_function).to eq("SHA-1")
    expect(gu.primary_email).to eq("<EMAIL>.org")
    expect(gu.external_ids).to match_array([{:type=>"custom", customType:"id_soce", :value=>123489},
        {:type=>"organization", :value=>"bfd1c2a2-9876-41f8-8a6a-a7caaa7019e7"},])
{'fraction_non_alphanumeric': 0.17049533381191673, 'fraction_numerical': 0.048815506101938265, 'mean_word_length': 4.676171079429735, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 50, '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': '7381904', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1040, 'n_words': 130}