<commit_before>(ns graphql-clj.executor-test
  (:use graphql-clj.executor)
  (:require [clojure.test :refer :all]
            [graphql-clj.type :as type]
            [graphql-clj.parser :as parser]
            [graphql-clj.introspection :as introspection]
            [clojure.core.match :as match]))

(def simple-user-schema-str
  "type User {
  name: String
  nickname: String
  son: User
  friends: [User]
  phones: [String!]!
}

type QueryRoot {
  user: User
}

type CreateUser {
  id: String
  name: String
}

type Mutation {
  createUser(name: String): CreateUser
}

schema {
  query: QueryRoot
  mutation: Mutation
}")

(def customized-resolver-fn
  (fn [type-name field-name]
    (match/match
      [type-name field-name]
      ["QueryRoot"  "user"] (fn [& args]
                              {:name "Test user name"
                               :nickname "Test user nickname"})
      ["User" "son"] (fn [context parent & args]
                       {:name "Test son name"
                        :nickname "Son's nickname"})
      ["User" "friends"] (fn [context parent & args]
                           (map (fn [no] {:name "Friend 1 name"
                                          :nickname "Friend 1 nickname"})
                                (range 5)))
      ["User" "phones"] (fn [context parent & args]<commit_msg>Generate friend's attrs based on index<commit_after>(ns graphql-clj.executor-test
  (:use graphql-clj.executor)
  (:require [clojure.test :refer :all]
            [graphql-clj.type :as type]
            [graphql-clj.parser :as parser]
            [graphql-clj.introspection :as introspection]
            [clojure.core.match :as match]))

(def simple-user-schema-str
  "type User {
  name: String
  nickname: String
  son: User
  friends: [User]
  phones: [String!]!
}

type QueryRoot {
  user: User
}

type CreateUser {
  id: String
  name: String
}

type Mutation {
  createUser(name: String): CreateUser
}

schema {
  query: QueryRoot
  mutation: Mutation
}")

(def customized-resolver-fn
  (fn [type-name field-name]
    (match/match
      [type-name field-name]
      ["QueryRoot"  "user"] (fn [& args]
                              {:name "<NAME>"
                               :nickname "Test user nickname"})
      ["User" "son"] (fn [context parent & args]
                       {:name "Test son name"
                        :nickname "Son's nickname"})
      ["User" "friends"] (fn [context parent & args]
                           (map (fn [no] {:name (format "Friend %s name" no)
                                          :nickname (format "Friend %s nickname" no)})
                                (range 5)))
      ["User" "phones"] (fn [context parent & args]
{'fraction_non_alphanumeric': 0.12716549944710653, 'fraction_numerical': 0.001474382602285293, 'mean_word_length': 1.8212058212058213, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2957992', 'n_tokens_mistral': 859, 'n_tokens_neox': 826, 'n_words': 230}