mapillary-js/spec/api/APIv2.spec.ts
Oscar Lorentzon b41d39ad53 Migrate to typings 1.0.
Fixes #135
2016-06-07 14:53:35 +02:00

40 lines
935 B
TypeScript

/// <reference path="../../typings/index.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 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();
});
});
});