<commit_before># frozen_string_literal: true

require File.dirname(__FILE__) + '/../test_helper.rb'
require "base64"

class Drip::ClientTest < Drip::TestCase
  context "initialization" do
    should "accept api key" do
      client = Drip::Client.new do |config|
        config.api_key = "aaaa"
      end

      assert_equal "aaaa", client.api_key
    end

    should "accept url prefix" do
      client = Drip::Client.new do |config|
        config.url_prefix = "aaaa"
      end

      assert_equal "aaaa", client.url_prefix
    end

    should "accept access token" do
      client = Drip::Client.new do |config|
        config.access_token = "aaaa"
      end

      assert_equal "aaaa", client.access_token
    end

    should "accept default account id" do
      client = Drip::Client.new do |config|
        config.account_id = "1234567"
      end

      assert_equal "1234567", client.account_id
    end

    should "accept options via arguments" do
      client = Drip::Client.new(
        account_id: "1234567",
        api_key: "aaaa",
        access_token: "bbbb",
        http_open_timeout: 20,
        http_timeout: 25,
        skip_analytics: true
      )

      assert_equal "1234567", client.account_id
      assert_equal "aaaa", client.api_key
      assert_equal "bbbb", client.access_token
      assert_equal 20, client.http_open_timeout
      assert_equal 25, client.http_timeout
      assert_equal true, client.skip_analytics
    end

    should "accept options after initialization" do<commit_msg>Improved test error to be more clear.<commit_after># frozen_string_literal: true

require File.dirname(__FILE__) + '/../test_helper.rb'
require "base64"

class Drip::ClientTest < Drip::TestCase
  context "initialization" do
    should "accept api key" do
      client = Drip::Client.new do |config|
        config.api_key = "aaaa"
      end

      assert_equal "aaaa", client.api_key
    end

    should "accept url prefix" do
      client = Drip::Client.new do |config|
        config.url_prefix = "aaaa"
      end

      assert_equal "aaaa", client.url_prefix
    end

    should "accept access token" do
      client = Drip::Client.new do |config|
        config.access_token = "aaaa"
      end

      assert_equal "aaaa", client.access_token
    end

    should "accept default account id" do
      client = Drip::Client.new do |config|
        config.account_id = "1234567"
      end

      assert_equal "1234567", client.account_id
    end

    should "accept options via arguments" do
      client = Drip::Client.new(
        account_id: "1234567",
        api_key: "aaaa",
        access_token: "bbbb",
        http_open_timeout: 20,
        http_timeout: 25,
        skip_analytics: true
      )

      assert_equal "1234567", client.account_id
      assert_equal "aaaa", client.api_key
      assert_equal "bbbb", client.access_token
      assert_equal 20, client.http_open_timeout
      assert_equal 25, client.http_timeout
      assert client.skip_analytics, "config should skip analytics"
    end

    should "accept options after initialization" do
{'fraction_non_alphanumeric': 0.0880441845354126, 'fraction_numerical': 0.024691358024691357, 'mean_word_length': 2.6351829988193622, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2454176', 'n_tokens_mistral': 986, 'n_tokens_neox': 906, 'n_words': 256}