-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMR-10146: Making sure validBbox compares numbers and not strings (#378)
* CMR-10146: Making sure validBbox compares numbers and not strings * CMR-10146: Adding comments * CMR-10146: Adjusting the bbox types and adding tests * CMR-10146: Making test prettier
- Loading branch information
1 parent
5d86a25
commit a5aff1b
Showing
2 changed files
with
46 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import chai from "chai"; | ||
const { expect } = chai; | ||
|
||
import { validBbox } from "../index"; | ||
|
||
describe("validBBOX", () => { | ||
describe("when bbox is a string", () => { | ||
it("returns a valid bbox", async () => { | ||
const bbox = "-122.09,39.89,-122.03,39.92"; | ||
expect(validBbox(bbox)).to.equal(true); | ||
}); | ||
}); | ||
|
||
describe("when bbox is a string array", () => { | ||
it("returns a valid bbox", async () => { | ||
const bbox = ["-122.09", "39.89", "-122.03", "39.92"]; | ||
expect(validBbox(bbox)).to.equal(true); | ||
}); | ||
}); | ||
|
||
describe("when bbox is an invalid string array with negative numbers", () => { | ||
it("returns an invalid bbox", async () => { | ||
const bbox = ["-122.03", "39.89", "-122.09", "39.92"]; | ||
expect(validBbox(bbox)).to.equal(false); | ||
}); | ||
}); | ||
|
||
describe("when bbox is a number array", () => { | ||
it("returns a valid bbox", async () => { | ||
const bbox = [-122.09, 39.89, -122.03, 39.92]; | ||
expect(validBbox(bbox)).to.equal(true); | ||
}); | ||
}); | ||
}); |
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