<commit_before># frozen_string_literal: true

require "rails_helper"

describe "API::SearchController" do
  describe "GET /api/search", type: :request do
    let!(:user) { create(:user) }

    context "with missing api key" do
      it "returns an error" do
        get "/api/search"

        expect(response).to have_http_status(:forbidden)
      end
    end

    context "with internal api key" do
      before :each do
        user.current_api_key.update_attribute(:is_internal, true)
      end

      it "renders successfully" do<commit_msg>Update search request test to use normal user<commit_after># frozen_string_literal: true

require "rails_helper"

describe "API::SearchController" do
  describe "GET /api/search", type: :request do
    let!(:user) { create(:user) }

    context "with missing api key" do
      it "returns an error" do
        get "/api/search"

        expect(response).to have_http_status(:forbidden)
      end
    end

    context "with valid api key" do
      it "renders successfully" do
{'fraction_non_alphanumeric': 0.09509803921568627, 'fraction_numerical': 0.0, 'mean_word_length': 3.1004016064257027, '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': '7199213', 'n_tokens_mistral': 308, 'n_tokens_neox': 298, 'n_words': 98}