<commit_before>"use strict";

import {doGet, doPost, doDel, USER_ID} from './Requester';
import {model} from '../../../../src/main/ts/model';

var expect = require('chai').expect;

export class AppDriver {

    async createRepositories(...names : string[]) : Promise<Array<model.RepositorySchema>> {

        for(let i = 0; i < names.length; i++) {
            await doPost('/repositories', {name : names[i]});
        }

        return await doGet('/repositories');
    }

    async getDependencyGraph() : Promise<model.DependencyGraphSchema> {
        let graphs : Array<model.DependencyGraphSchema> = await doGet('/dependency_graphs');
        expect(graphs.length).equals(1);
        return graphs[0];
    }

    async requestBuild(repo : string, commit : string) : Promise<model.PipelineSchema> {
        let pipeline : model.PipelineSchema = await doPost('/build_requests', {repo : repo, commit : commit});
        expect(pipeline.status).equals(model.PipelineStatus.RUNNING);
        return pipeline;
    }

    async getBuild(id : number) : Promise<model.BuildSchema> {
        let build : model.BuildSchema = await doGet('/builds/' + id);
        expect(build._id).equals(id);
        return build;<commit_msg>added extra checks to create repository driver<commit_after>"use strict";

import {doGet, doPost, doDel, USER_ID} from './Requester';
import {model} from '../../../../src/main/ts/model';

var expect = require('chai').expect;

export class AppDriver {

    async createRepositories(...names : string[]) : Promise<Array<model.RepositorySchema>> {

        for(let i = 0; i < names.length; i++) {
            await doPost('/repositories', {name : names[i]});
        }

        let allRepos : Array<model.RepositorySchema> =  await doGet('/repositories');
        let newRepos = allRepos.filter(repo => names.some(name => repo.name == name));

        expect(names.length).equals(newRepos.length);
        names.forEach(name => expect(allRepos.some(repo => repo.name == name)).to.be.true);

        return newRepos;
    }

    async getDependencyGraph() : Promise<model.DependencyGraphSchema> {
        let graphs : Array<model.DependencyGraphSchema> = await doGet('/dependency_graphs');
        expect(graphs.length).equals(1);
        return graphs[0];
    }

    async requestBuild(repo : string, commit : string) : Promise<model.PipelineSchema> {
        let pipeline : model.PipelineSchema = await doPost('/build_requests', {repo : repo, commit : commit});
        expect(pipeline.status).equals(model.PipelineStatus.RUNNING);
        return pipeline;
    }

    async getBuild(id : number) : Promise<model.BuildSchema> {
        let build : model.BuildSchema = await doGet('/builds/' + id);
        expect(build._id).equals(id);
        return build;
{'fraction_non_alphanumeric': 0.1479076479076479, 'fraction_numerical': 0.0021645021645021645, 'mean_word_length': 3.1326378539493294, 'pattern_counts': {'":': 0, '<': 18, '<?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': '5980171', 'n_tokens_mistral': 800, 'n_tokens_neox': 783, 'n_words': 176}