Skip to content

Commit

Permalink
add newMachine wrapper (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
clintpurser authored Jan 29, 2024
1 parent a1e2e7f commit b3441d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/src/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,13 @@ class AppClient {
..userId = userId;
await _client.deleteOrganizationMember(request);
}

/// Create a new smart machine with the included [name] in the passed in [locationId]
Future<String> newMachine(String name, String locationId) async {
final request = NewRobotRequest()
..name = name
..location = locationId;
final response = await _client.newRobot(request);
return response.id;
}
}
7 changes: 7 additions & 0 deletions test/unit_test/app/app_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ void main() {
verify(serviceClient.deleteOrganizationMember(any)).called(1);
});

test('newMachine', () async {
final expected = NewRobotResponse();
when(serviceClient.newRobot(any)).thenAnswer((_) => MockResponseFuture.value(expected));
await appClient.newMachine('test', 'fake-id');
verify(serviceClient.newRobot(any)).called(1);
});

test('tailLogs', () async {
final expected = LogEntry()..message = 'My log entry';
final response = TailRobotPartLogsResponse()..logs.add(expected);
Expand Down

0 comments on commit b3441d3

Please sign in to comment.