<commit_before>require 'spec_helper'

describe 'delete_values' do
  it { is_expected.not_to eq(nil) }
  it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError) }
  it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError) }
  it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError) }
  it { is_expected.to run.with_params('one', 'two', 'three').and_raise_error(Puppet::ParseError) }
  describe 'when the first argument is not a hash' do
    it { is_expected.to run.with_params(1, 'two').and_raise_error(TypeError) }
    it { is_expected.to run.with_params('one', 'two').and_raise_error(TypeError) }
    it { is_expected.to run.with_params([], 'two').and_raise_error(TypeError) }
  end

  describe 'when deleting from a hash' do
    it { is_expected.to run.with_params({}, 'value').and_return({}) }
    it { is_expected.to run \
      .with_params({'key1' => 'value1'}, 'non-existing value') \
      .and_return({'key1' => 'value1'})
    }
    it { is_expected.to run \
      .with_params({'key1' => 'value1', 'key2' => 'value to delete'}, 'value to delete') \
      .and_return({'key1' => 'value1'})
    }
    it { is_expected.to run \
      .with_params({'key1' => 'value1', 'key2' => 'value to delete', 'key3' => 'value to delete'}, 'value to delete') \
      .and_return({'key1' => 'value1'})
    }
  end

  it "should leave the original argument intact" do
    argument = { 'key1' => 'value1', 'key2' => 'value2' }
    original = argument.dup
    result = subject.call([argument, 'value2'])
    expect(argument).to eq(original)
  end<commit_msg>Adding unit test for i18n delete_value function<commit_after>require 'spec_helper'

describe 'delete_values' do
  it { is_expected.not_to eq(nil) }
  it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError) }
  it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError) }
  it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError) }
  it { is_expected.to run.with_params('one', 'two', 'three').and_raise_error(Puppet::ParseError) }
  describe 'when the first argument is not a hash' do
    it { is_expected.to run.with_params(1, 'two').and_raise_error(TypeError) }
    it { is_expected.to run.with_params('one', 'two').and_raise_error(TypeError) }
    it { is_expected.to run.with_params([], 'two').and_raise_error(TypeError) }
  end

  describe 'when deleting from a hash' do
    it { is_expected.to run.with_params({}, 'value').and_return({}) }
    it { is_expected.to run \
      .with_params({'key1' => 'value1'}, 'non-existing value') \
      .and_return({'key1' => 'value1'})
    }
    it { is_expected.to run \
      .with_params({'ҝếỵ1 ' => 'νâĺūẹ1', 'ҝếỵ2' => 'value to delete'}, 'value to delete') \
      .and_return({'ҝếỵ1 ' => 'νâĺūẹ1'})
    }
    it { is_expected.to run \
      .with_params({'key1' => 'value1', 'key2' => 'νǎŀữ℮ ťớ đêłểťė'}, 'νǎŀữ℮ ťớ đêłểťė') \
      .and_return({'key1' => 'value1'})
    }
    it { is_expected.to run \
      .with_params({'key1' => 'value1', 'key2' => 'value to delete', 'key3' => 'value to delete'}, 'value to delete') \
      .and_return({'key1' => 'value1'})
    }
  end

  it "should leave the original argument intact" do
    argument = { 'key1' => 'value1', 'key2' => 'value2' }
    original = argument.dup
    result = subject.call([argument, 'value2'])
    expect(argument).to eq(original)
  end
{'fraction_non_alphanumeric': 0.17061750073163595, 'fraction_numerical': 0.014925373134328358, 'mean_word_length': 3.84822695035461, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 28, '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': '6943252', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1275, 'n_words': 257}