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

import * as when from "when";

import {APIv2, IAPINavIm} from "../../src/API";

describe("APIv2", () => {
    var apiV2: APIv2;

    beforeEach(() => {
        apiV2 = new APIv2("clientId")
    });

    it("exists", () => {
        expect(apiV2).toBeDefined();
    });

    it("calls h", (done) => {
        spyOn(apiV2.nav, "callApi").and.returnValue(when(null));

        let h: string = "hash";
        apiV2.nav.h(h).then((response: IAPINavIm) => {
            expect(apiV2.nav.callApi).toHaveBeenCalledWith("nav/h/" + h);

            done();
        });
    });

    it("calls im", (done) => {
        spyOn(apiV2.nav, "callApi").and.returnValue(when(null));

        let im: string = "key";
        apiV2.nav.im(im).then((response: IAPINavIm) => {
            expect(apiV2.nav.callApi).toHaveBeenCalledWith("nav/im/" + im);

            done();
        });
    });
});<commit_msg>Test that API im or is called correctly.<commit_after>/// <reference path="../../typings/jasmine/jasmine.d.ts" />
/// <reference path="../../typings/when/when.d.ts" />

import * as when from "when";

import {APIv2, IAPINavIm, IAPIImOr} from "../../src/API";

describe("APIv2", () => {
    var apiV2: APIv2;

    beforeEach(() => {
        apiV2 = new APIv2("clientId")
    });

    it("exists", () => {
        expect(apiV2).toBeDefined();
    });

    it("calls im or", (done) => {
        spyOn(apiV2.im, "callApi").and.returnValue(when(null));

        let im: string = "key";
        apiV2.im.callOr(im).then((response: IAPIImOr) => {
            expect(apiV2.im.callApi).toHaveBeenCalledWith("im/" + im + "/or");

            done();
        });
    });

    it("calls nav h", (done) => {
        spyOn(apiV2.nav, "callApi").and.returnValue(when(null));

        let h: string = "hash";
        apiV2.nav.h(h).then((response: IAPINavIm) => {
            expect(apiV2.nav.callApi).toHaveBeenCalledWith("nav/h/" + h);

            done();
        });
    });

    it("calls nav im", (done) => {
        spyOn(apiV2.nav, "callApi").and.returnValue(when(null));

        let im: string = "key";
        apiV2.nav.im(im).then((response: IAPINavIm) => {
            expect(apiV2.nav.callApi).toHaveBeenCalledWith("nav/im/" + im);

            done();
        });
    });
});
{'fraction_non_alphanumeric': 0.21673640167364017, 'fraction_numerical': 0.012133891213389121, 'mean_word_length': 2.192256341789052, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, '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': '7354442', 'n_tokens_mistral': 866, 'n_tokens_neox': 859, 'n_words': 132}