<commit_before>// Need to include the next line for Visual Studio Code 
// intellisense to work for jest types
import {} from 'jest';

import * as request from 'supertest';
import { graphql } from 'graphql';
import schema from './schema';
const DataLoader = require('dataloader');
import {
    fetchPeopleWithPlanet,
    fetchPeople,
    fetchPlanet,
    fetchStarship
  } from './dataloader/starwars';
import '../common/env';


describe('Example Service Tests', () => {
/*
    let originalTimeout;
    beforeEach(() => {
        originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
        jasmine.DEFAULT_TIMEOUT_INTERVAL = Number(process.env.TIMEOUT);
    });

    afterEach(function() {
        jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
    });
*/
    it('should be returning a quote ', async () => {
        const query = `
        query Q {
            quoteOfTheDay
        }
      `;
        const rootValue = {};
        const result = await graphql(schema, query, rootValue);
        const { data } = result;
        expect(data.quoteOfTheDay).not.toHaveLength(0);
    });

    it('should be returning a random number > 0 ', async () => {
        const query = `
        query Q {
            random
        }
      `;
        const rootValue = {};
        const result = await graphql(schema, query, rootValue);
        const { data } = result;
        expect(data.random).toBeGreaterThan(0);
    });

    it('should be returning a starwars people result for "<NAME>" ', async () => {
        const query = `
        query Q {
            people(id: 1) {
                name
            }
        }
      `;
        const expectedValue = '<NAME>';
        const rootValue = {};
        const peopleLoader = new DataLoader(keys => Promise.all(keys.map(fetchPeople)));
        const contextValue = {
            peopleLoader
        }
        const result = await graphql(schema, query, rootValue, contextValue);
        const { people } = result.data;
        expect(people.name).toEqual(expectedValue);
    });


});<commit_msg>Added timeout for swapi test<commit_after>// Need to include the next line for Visual Studio Code 
// intellisense to work for jest types
import {} from 'jest';

import * as request from 'supertest';
import { graphql } from 'graphql';
import schema from './schema';
const DataLoader = require('dataloader');
import {
    fetchPeopleWithPlanet,
    fetchPeople,
    fetchPlanet,
    fetchStarship
  } from './dataloader/starwars';
import '../common/env';


describe('Example Service Tests', () => {
/*
    let originalTimeout;
    beforeEach(() => {
        originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
        jasmine.DEFAULT_TIMEOUT_INTERVAL = Number(process.env.TIMEOUT);
    });

    afterEach(function() {
        jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
    });
*/
    it('should be returning a quote ', async () => {
        const query = `
        query Q {
            quoteOfTheDay
        }
      `;
        const rootValue = {};
        const result = await graphql(schema, query, rootValue);
        const { data } = result;
        expect(data.quoteOfTheDay).not.toHaveLength(0);
    });

    it('should be returning a random number > 0 ', async () => {
        const query = `
        query Q {
            random
        }
      `;
        const rootValue = {};
        const result = await graphql(schema, query, rootValue);
        const { data } = result;
        expect(data.random).toBeGreaterThan(0);
    });

    it('should be returning a starwars people result for "Luke Skywalker" ', async () => {
        const query = `
        query Q {
            people(id: 1) {
                name
            }
        }
      `;
        const expectedValue = '<NAME>';
        const rootValue = {};
        const peopleLoader = new DataLoader(keys => Promise.all(keys.map(fetchPeople)));
        const contextValue = {
            peopleLoader
        }
        const result = await graphql(schema, query, rootValue, contextValue);
        const { people } = result.data;
        expect(people.name).toEqual(expectedValue);
    },10000);


});
{'fraction_non_alphanumeric': 0.1194572328567967, 'fraction_numerical': 0.003149987884661982, 'mean_word_length': 2.1901081916537866, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 20, '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': '2463679', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1133, 'n_words': 300}