Skip to content

Commit

Permalink
fix(isochrones): update API tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aoles committed Nov 29, 2023
1 parent fcadc05 commit bce8ff5
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

import io.restassured.RestAssured;
import io.restassured.config.RestAssuredConfig;
import io.restassured.path.json.JsonPath;
import io.restassured.path.json.config.JsonPathConfig;
import org.heigit.ors.apitests.common.EndPointAnnotation;
import org.heigit.ors.apitests.common.ServiceTest;
import org.heigit.ors.apitests.common.VersionAnnotation;
import org.heigit.ors.apitests.utils.CommonHeaders;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
Expand Down Expand Up @@ -135,7 +135,7 @@ void testPolygon() {
.then()
.body("any { it.key == 'type' }", is(true))
.body("any { it.key == 'features' }", is(true))
.body("features[0].geometry.coordinates[0].size()", is(both(greaterThan(48)).and(lessThan(54))))
.body("features[0].geometry.coordinates[0].size()", is(both(greaterThan(46)).and(lessThan(50))))
.body("features[0].properties.center.size()", is(2))
.body("bbox", hasItems(closeTo(8.663323f, 0.001f), closeTo(49.40837f, 0.001f), closeTo(8.700336f, 0.001f), closeTo(49.439884f, 0.001f)))
.body("features[0].type", is("Feature"))
Expand Down Expand Up @@ -271,7 +271,7 @@ void testReachfactorAndArea() {
.body("any { it.key == 'type' }", is(true))
.body("any { it.key == 'features' }", is(true))
.body("features[0].properties.area", is(closeTo(6600000, 132000)))
.body("features[0].properties.reachfactor", is(closeTo(0.7429, 0.0148)))
.body("features[0].properties.reachfactor", is(closeTo(0.7629, 0.0148)))
.statusCode(200);

}
Expand All @@ -296,7 +296,7 @@ void testReachfactorAndAreaAreaUnitsM() {
.body("any { it.key == 'type' }", is(true))
.body("any { it.key == 'features' }", is(true))
.body("features[0].properties.area", is(closeTo(6600000, 132000)))
.body("features[0].properties.reachfactor", is(closeTo(0.7429, 0.0148)))
.body("features[0].properties.reachfactor", is(closeTo(0.7629, 0.0148)))
.statusCode(200);

}
Expand All @@ -320,8 +320,8 @@ void testReachfactorAndAreaAreaUnitsKM() {
.then()
.body("any { it.key == 'type' }", is(true))
.body("any { it.key == 'features' }", is(true))
.body("features[0].properties.area", is(closeTo(6.48, 0.132)))
.body("features[0].properties.reachfactor", is(closeTo(0.7429, 0.0148)))
.body("features[0].properties.area", is(closeTo(6.60, 0.132)))
.body("features[0].properties.reachfactor", is(closeTo(0.7629, 0.0148)))
.statusCode(200);

}
Expand Down Expand Up @@ -372,7 +372,7 @@ void testReachfactorAndAreaAreaUnitsMI() {
.body("any { it.key == 'type' }", is(true))
.body("any { it.key == 'features' }", is(true))
.body("features[0].properties.area", is(closeTo(2.55, 0.05)))
.body("features[0].properties.reachfactor", is(closeTo(0.7429, 0.0148)))
.body("features[0].properties.reachfactor", is(closeTo(0.7629, 0.0148)))
.statusCode(200);

}
Expand Down Expand Up @@ -403,11 +403,11 @@ void testIntersections() {
.body("features[2].type", is("Feature"))
.body("features[2].geometry.type", is("Polygon"))
//.body("features[2].geometry.coordinates[0].size()", is(26))
.body("features[2].geometry.coordinates[0].size()", is(both(greaterThan(39)).and(lessThan(41))))
.body("features[2].geometry.coordinates[0].size()", is(both(greaterThan(40)).and(lessThan(44))))
.body("features[2].properties.contours.size()", is(2))
.body("features[2].properties.containsKey('area')", is(true))
//.body("features[2].properties.area", is(5824280.5f))
.body("features[0].properties.area", is(both(greaterThan(6400000f)).and(lessThan(6600000f))))
.body("features[0].properties.area", is(both(greaterThan(6600000f)).and(lessThan(6700000f))))
.body("features[2].properties.contours[0][0]", is(0))
.body("features[2].properties.contours[0][1]", is(0))
.body("features[2].properties.contours[1][0]", is(1))
Expand Down Expand Up @@ -490,7 +490,7 @@ void testCompleteMetadata() {
.statusCode(200);
}


@Disabled
@ParameterizedTest
@CsvSource({
"locations_1, cycling-regular, distance, 10, 1, 200;400;600;1000;2000",
Expand Down

0 comments on commit bce8ff5

Please sign in to comment.