Skip to content

Commit

Permalink
feat(toBeMultiPolygonWithHole): add new matcher
Browse files Browse the repository at this point in the history
Verifies an object is a valid GeoJSON MultiPolygon Geometry with at least one polygon having a hole.

Resolves: #44
  • Loading branch information
M-Scott-Lassiter committed Jun 10, 2022
1 parent 3eb435c commit 6668a1b
Show file tree
Hide file tree
Showing 65 changed files with 1,371 additions and 5 deletions.
1 change: 1 addition & 0 deletions .cz-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const allMatchers = [
{ name: 'toBeMultiLineStringGeometry' },
{ name: 'toBeMultiPointGeometry' },
{ name: 'toBeMultiPolygonGeometry' },
{ name: 'toBeMultiPolygonWithHole' },
{ name: 'toBePointGeometry' },
{ name: 'toBePolygonGeometry' },
{ name: 'toBePolygonWithHole' },
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ Functional matchers assess more generic attributes and qualities and many accept
- [toBeMultiLineStringGeometry](https://m-scott-lassiter.github.io/jest-geojson/Matchers.Geometries.html#.toBeMultiLineStringGeometry)
- [toBeMultiPointGeometry](https://m-scott-lassiter.github.io/jest-geojson/Matchers.Geometries.html#.toBeMultiPointGeometry)
- [toBeMultiPolygonGeometry](https://m-scott-lassiter.github.io/jest-geojson/Matchers.Geometries.html#.toBeMultiPolygonGeometry)
- [toBeMultiPolygonWithHole](https://m-scott-lassiter.github.io/jest-geojson/Matchers.Geometries.html#.toBeMultiPolygonWithHole)
- [toBePointGeometry](https://m-scott-lassiter.github.io/jest-geojson/Core.Geometries.html#.pointGeometry)
- [toBePolygonGeometry](https://m-scott-lassiter.github.io/jest-geojson/Matchers.Geometries.html#.toBePolygonGeometry)
- [toBePolygonWithHole](https://m-scott-lassiter.github.io/jest-geojson/Matchers.Geometries.html#.toBePolygonWithHole)
Expand All @@ -169,7 +170,6 @@ Functional matchers assess more generic attributes and qualities and many accept

_Future_

- [ ] toBeMultiPolygonWithHole
- [ ] toHaveMinGeometryCount
- [ ] toHaveMaxGeometeyCount
- [ ] toHaveGeometeyCount (equal/min, max)
Expand Down
5 changes: 5 additions & 0 deletions docs/Core.BoundingBoxes.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/Core.Coordinates.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/Core.FeatureCollections.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/Core.Features.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/Core.Geometries.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/Core.Utilities.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/Core.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/Matchers.BoundingBoxes.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/Matchers.Coordinates.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/Matchers.FeatureCollections.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/Matchers.Features.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/Matchers.Functional.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
151 changes: 150 additions & 1 deletion docs/Matchers.Geometries.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down Expand Up @@ -1025,6 +1030,150 @@ <h5>Parameters:</h5>
</tbody>
</table>

<h4 class="name" id=".toBeMultiPolygonWithHole">
<span class="type-signature">(static) </span>toBeMultiPolygonWithHole<span
class="signature"
>(geometryObject)</span
><span class="type-signature"></span>
</h4>

<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="matchers_geometries_toBeMultiPolygonWithHole.js.html"
>matchers/geometries/toBeMultiPolygonWithHole.js</a
>,
<a
href="matchers_geometries_toBeMultiPolygonWithHole.js.html#line86"
>line 86</a
>
</li>
</ul>
</dd>

<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li>
<a
href="https://github.com/M-Scott-Lassiter/jest-geojson/issues/44"
>https://github.com/M-Scott-Lassiter/jest-geojson/issues/44</a
>
</li>
</ul>
</dd>
</dl>

<div class="description usertext">
Verifies an object is a valid GeoJSON MultiPolygon Geometry with at least
one polygon having a hole.
</div>

<h5>Examples</h5>

<pre class="prettyprint"><code>const multiPolygon1 = {
type: 'MultiPolygon',
coordinates: [
[
[
[102.0, 2.0],
[103.0, 2.0],
[103.0, 3.0],
[102.0, 3.0],
[102.0, 2.0]
]
],
[
[
[100.0, 0.0],
[101.0, 0.0],
[101.0, 1.0],
[100.0, 1.0],
[100.0, 0.0]
],
[
[100.2, 0.2],
[100.2, 0.8],
[100.8, 0.8],
[100.8, 0.2],
[100.2, 0.2]
]
]
]
}

test('Object is valid MultiPolygon With Hole', () => {
expect(multiPolygon1).toBeMultiPolygonWithHole()
})</code></pre>

<pre class="prettyprint"><code>const multiPolygon2 = {
type: 'MultiPolygon',
coordinates: [
[
[
[102.0, 2.0],
[103.0, 2.0],
[103.0, 3.0],
[102.0, 3.0],
[102.0, 2.0]
]
]
]
}
const polygon = {
type: 'Polygon',
coordinates: [
[
[100.0, 0.0],
[101.0, 0.0],
[101.0, 1.0],
[100.0, 1.0],
[100.0, 0.0]
],
[
[100.2, 0.2],
[100.2, 0.8],
[100.8, 0.8],
[100.8, 0.2],
[100.2, 0.2]
]
]
}

test('Not a MultiPolygon, or does not have a hole', () => {
expect(multiPolygon2).not.toBeMultiPolygonWithHole()
expect(multiPolygon1.coordinates[2][1]).not.toBeMultiPolygonWithHole()
expect(polygon).not.toBeMultiPolygonWithHole()
})</code></pre>

<h5>Parameters:</h5>

<table class="params">
<thead>
<tr>
<th>Name</th>

<th>Type</th>

<th class="last">Description</th>
</tr>
</thead>

<tbody>
<tr>
<td class="name"><code>geometryObject</code></td>

<td class="type">
<span class="param-type">object</span>
</td>

<td class="description last">a GeoJSON Polygon Geometry object</td>
</tr>
</tbody>
</table>

<h4 class="name" id=".toBePointGeometry">
<span class="type-signature">(static) </span>toBePointGeometry<span
class="signature"
Expand Down Expand Up @@ -1319,7 +1468,7 @@ <h5>Examples</h5>
]
}

test('Not a polygon, or doesn't have a hole', () => {
test('Not a Polygon, or does not have a hole', () => {
expect(polygon2).not.toBePolygonWithHole()
expect(polygon1.coordinates[1]).not.toBePolygonWithHole()
expect(point).not.toBePolygonWithHole()
Expand Down
5 changes: 5 additions & 0 deletions docs/Matchers.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/core_boundingBoxes_valid2DBoundingBox.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/core_boundingBoxes_valid3DBoundingBox.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/core_boundingBoxes_validBoundingBox.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
5 changes: 5 additions & 0 deletions docs/core_coordinates_valid2DCoordinate.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ <h3>Namespaces</h3>
>toBeMultiPolygonGeometry</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBeMultiPolygonWithHole"
>toBeMultiPolygonWithHole</a
>
</li>
<li data-type="method">
<a href="Matchers.Geometries.html#.toBePointGeometry"
>toBePointGeometry</a
Expand Down
Loading

0 comments on commit 6668a1b

Please sign in to comment.