<commit_before>import {resolve} from "path"

import test from "ava"
import pq from "proxyquire"
import {GraphQLString as TString} from "graphql"

import Schema from "parasprite"

const mockIntrospectHelperDeps = (deps = {}) => pq(
  resolve(__dirname, "..", "..", "..", "helper/util/introspect"), {
    ...deps
  }
)

const schema = Schema()
  .query("Query")
    .resolve("phrase", TString, true, () => "Let's go, pal.")
    .end()
  .end()
.end()

test("Should have additional methods on default export", t => {
  t.plan(2)

  const introspect = mockIntrospectHelperDeps()

  t.is(typeof introspect.default.asObject, "function")
  t.is(typeof introspect.default.asJSON, "function")
})

test("Should return a promise", t => {
  t.plan(1)

  const introspect = mockIntrospectHelperDeps({
    fs: {
      writeFile() {
        // noop
      }
    }
  })

  const res = introspect.default(schema, __dirname, {spaces: 2})

  t.true(res instanceof Promise)
})<commit_msg>Fix code coverage.<commit_after>import {resolve} from "path"

import test from "ava"
import pq from "proxyquire"
import {GraphQLString as TString} from "graphql"

import Schema from "parasprite"

import introspect from "helper/util/introspect"

const mockIntrospectHelperDeps = (deps = {}) => pq(
  resolve(__dirname, "..", "..", "..", "helper/util/introspect"), {
    ...deps
  }
)

const schema = Schema()
  .query("Query")
    .resolve("phrase", TString, true, () => "Let's go, pal.")
    .end()
  .end()
.end()

test("Should have additional methods on default export", t => {
  t.plan(2)

  t.is(typeof introspect.asObject, "function")
  t.is(typeof introspect.asJSON, "function")
})

test("Should return a promise", t => {
  t.plan(1)

  const introspect = mockIntrospectHelperDeps({
    fs: {
      writeFile() {
        // noop
      }
    }
  })

  const res = introspect.default(schema, __dirname, {spaces: 2})

  t.true(res instanceof Promise)
})
{'fraction_non_alphanumeric': 0.1643265730629225, 'fraction_numerical': 0.0031201248049922, 'mean_word_length': 3.474418604651163, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '5501397', 'n_tokens_mistral': 681, 'n_tokens_neox': 663, 'n_words': 165}