Created
July 11, 2019 19:47
-
-
Save newbenhd/237e98c6ab7d4b7a35851d5f8af3923f to your computer and use it in GitHub Desktop.
mapbox service test cases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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