<commit_before>/// <reference path="../typings/main.d.ts" />

import {ApiDocumentation} from "../src/ApiDocumentation";
import {Documentations} from './test-objects';

describe('ApiDocumentation', () => {

    it('should get operation\'s method and description given a type', done => {

        var docs = new ApiDocumentation('', Documentations.classWithOperation);

        var op = docs.getOperations('http://example.com/api#Class')
            .then(op => {
                expect(op[0].description).toBe('Gets the api#Class');
                expect(op[0].method).toBe('GET');
                done();
            })
            .catch(done.fail);
    });

    it('should get properties for a given class type', done => {

        var docs = new ApiDocumentation('', Documentations.classWithOperation);

        var op = docs.getProperties('http://example.com/api#Class')
            .then(props => {
                expect(props.length).toBe(2);
                done();
            })
            .catch(done.fail);
    });

    it('should return classes from documentation', done => {

        var docs = new ApiDocumentation('', Documentations.classWithOperation);

        var classes = docs.getClasses()
            .then(classes => {
                expect(classes.length).toBe(1);
                expect(classes[0].id).toBe('http://example.com/api#Class');
                done();
            })
            .catch(done.fail);
    });

    it('should return selected class by @id', done => {

        var docs = new ApiDocumentation('', Documentations.classWithOperation);

        var classes = docs.getClass('http://example.com/api#Class')
            .then(clas => {
                expect(clas.id).toBe('http://example.com/api#Class');
                done();
            })
            .catch(done.fail);
    });
});<commit_msg>group ApiDocumentation tests<commit_after>/// <reference path="../typings/main.d.ts" />

import {ApiDocumentation} from "../src/ApiDocumentation";
import {Documentations} from './test-objects';

describe('ApiDocumentation', () => {

    describe('getting operations', () => {

        it('should get operation\'s method and description given a type', done => {

            var docs = new ApiDocumentation('', Documentations.classWithOperation);

            var op = docs.getOperations('http://example.com/api#Class')
                .then(op => {
                    expect(op[0].description).toBe('Gets the api#Class');
                    expect(op[0].method).toBe('GET');
                    done();
                })
                .catch(done.fail);
        });

    });

    describe('getting properties', () => {

        it('should get properties for a given class type', done => {

            var docs = new ApiDocumentation('', Documentations.classWithOperation);

            var op = docs.getProperties('http://example.com/api#Class')
                .then(props => {
                    expect(props.length).toBe(2);
                    done();
                })
                .catch(done.fail);
        });

    });

    describe('getting classes', () => {

        it('should return classes from documentation', done => {

            var docs = new ApiDocumentation('', Documentations.classWithOperation);

            var classes = docs.getClasses()
                .then(classes => {
                    expect(classes.length).toBe(1);
                    expect(classes[0].id).toBe('http://example.com/api#Class');
                    done();
                })
                .catch(done.fail);
        });

        it('should return selected class by @id', done => {

            var docs = new ApiDocumentation('', Documentations.classWithOperation);

            var classes = docs.getClass('http://example.com/api#Class')
                .then(clas => {
                    expect(clas.id).toBe('http://example.com/api#Class');
                    done();
                })
                .catch(done.fail);
        });

    });
});
{'fraction_non_alphanumeric': 0.15407629020194466, 'fraction_numerical': 0.0024931438544003987, 'mean_word_length': 1.7958188153310104, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, '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': '4016018', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1002, 'n_words': 200}