You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dde_gesture_manager/api/test/simple_controller_test.dart

33 lines
908 B

import 'harness/app.dart';
Future main() async {
final harness = Harness()..install();
tearDown(() async {
await harness.resetData();
});
test("POST /model", () async {
final response = await harness.agent!.post("/model", body: {"name": "Bob"});
expect(
response,
hasResponse(200,
body: {"id": isNotNull, "name": "Bob", "createdAt": isTimestamp}));
});
test("GET /model/:id returns previously created object", () async {
var response = await harness.agent!.post("/model", body: {"name": "Bob"});
final createdObject = response?.body.as();
response =
await harness.agent!.request("/model/${createdObject["id"]}").get();
expect(
response,
hasResponse(200, body: {
"id": createdObject["id"],
"name": createdObject["name"],
"createdAt": createdObject["createdAt"]
}));
});
}