<commit_before>require_relative '../../../lib/api/generic/id'

describe IPFS::Client do
  let(:node_id) { File.read File.join('spec', 'fixtures', 'id.json')  }
  let(:uri) { 'http://localhost:5001/api/v0/id' }

  it 'is an IPFS::Client' do
    expect(described_class.new).to be_a IPFS::Client
  end

  describe '#id' do
    context 'when daemon is started' do
      before do
        stub_request(:get, uri)
          .to_return(
            status: 200,
            headers: { 'Content-Type': 'application/json' },
            body: node_id
          )
      end

      let!(:client_id) { described_class.id }

      it 'calls the Ipfs API' do
        expect(WebMock).to have_requested(:get, uri)
      end

      it 'hashes the response' do
        expect(client_id).to be_a Hash
      end

      it 'has the correct ID' do<commit_msg>updated dependancy path in id spec file<commit_after>require_relative '../../../lib/ipfs-api'

describe IPFS::Client do
  let(:node_id) { File.read File.join('spec', 'fixtures', 'id.json')  }
  let(:uri) { 'http://localhost:5001/api/v0/id' }

  it 'is an IPFS::Client' do
    expect(described_class.new).to be_a IPFS::Client
  end

  describe '#id' do
    context 'when daemon is started' do
      before do
        stub_request(:get, uri)
          .to_return(
            status: 200,
            headers: { 'Content-Type': 'application/json' },
            body: node_id
          )
      end

      let!(:client_id) { described_class.id }

      it 'calls the Ipfs API' do
        expect(WebMock).to have_requested(:get, uri)
      end

      it 'hashes the response' do
        expect(client_id).to be_a Hash
      end

      it 'has the correct ID' do
{'fraction_non_alphanumeric': 0.1292798110979929, 'fraction_numerical': 0.009445100354191263, 'mean_word_length': 2.222433460076046, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4794558', 'n_tokens_mistral': 577, 'n_tokens_neox': 556, 'n_words': 145}