Skip to content

Instantly share code, notes, and snippets.

@newbenhd
Created July 11, 2019 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save newbenhd/237e98c6ab7d4b7a35851d5f8af3923f to your computer and use it in GitHub Desktop.
Save newbenhd/237e98c6ab7d4b7a35851d5f8af3923f to your computer and use it in GitHub Desktop.
mapbox service test cases
const mapbox = require("./mapbox");
const { assert } = require("chai");
describe("--> mapbox module test <--", () => {
describe("forwardGeocoding() test", () => {
it("should have response with default", () => {
mapbox.forwardGeocoding(undefined, undefined, {}, (error, response) => {
// if (error) throw error;
assert.isObject(response, "is not an object?");
});
});
it("should have response with search_text", () => {
mapbox.forwardGeocoding(
undefined,
"San Francisco",
{},
(error, response) => {
// if (error) throw error;
assert.isObject(response, "is not an object?");
}
);
});
it("should handle unable to connect 501", () => {
mapbox.forwardGeocoding(
undefined,
"San Francisco",
{},
(error, response) => {
assert.equal(error.code, 501, "is not code 501?");
}
);
});
it("should handle unauthorized error 401", () => {
mapbox.setAccessToken("random-asdjfklaskdfj");
mapbox.forwardGeocoding(
undefined,
"San Francisco",
{},
(error, response) => {
assert.equal(error.code, 401, "is not code 401?");
}
);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment