Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vpandiarajan20 committed Dec 2, 2024
1 parent cd6d1e8 commit 242bef2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 26 deletions.
1 change: 0 additions & 1 deletion lib/src/app/data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ class DataClient {
response.payload.toStruct().toMap(),
);
}

}

/// {@category Viam SDK}
Expand Down
35 changes: 10 additions & 25 deletions test/unit_test/app/data_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -411,27 +411,18 @@ void main() {
});
});
});

test('getLatestTabularData', () async {
final timeCaptured = DateTime(2023, 1, 1);
final timeSynced = DateTime(2023, 1, 2);
final payload = Struct()..fields.addAll({
'key': Value()..stringValue = 'value'
});
final payload = Struct()..fields.addAll({'key': Value()..stringValue = 'value'});

when(dataServiceClient.getLatestTabularData(any)).thenAnswer((_) => MockResponseFuture.value(
GetLatestTabularDataResponse()
..timeCaptured = Timestamp.fromDateTime(timeCaptured)
..timeSynced = Timestamp.fromDateTime(timeSynced)
..payload = payload
));
when(dataServiceClient.getLatestTabularData(any)).thenAnswer((_) => MockResponseFuture.value(GetLatestTabularDataResponse()
..timeCaptured = Timestamp.fromDateTime(timeCaptured)
..timeSynced = Timestamp.fromDateTime(timeSynced)
..payload = payload));

final response = await dataClient.getLatestTabularData(
'part-id',
'resource-name',
'resource-subtype',
'method-name'
);
final response = await dataClient.getLatestTabularData('part-id', 'resource-name', 'resource-subtype', 'method-name');

expect(response?.$1, equals(timeCaptured));
expect(response?.$2, equals(timeSynced));
Expand All @@ -440,15 +431,9 @@ void main() {
verify(dataServiceClient.getLatestTabularData(any)).called(1);

// Test null response
when(dataServiceClient.getLatestTabularData(any)).thenAnswer((_) =>
MockResponseFuture.value(GetLatestTabularDataResponse()));

final nullResponse = await dataClient.getLatestTabularData(
'part-id',
'resource-name',
'resource-subtype',
'method-name'
);
when(dataServiceClient.getLatestTabularData(any)).thenAnswer((_) => MockResponseFuture.value(GetLatestTabularDataResponse()));

final nullResponse = await dataClient.getLatestTabularData('part-id', 'resource-name', 'resource-subtype', 'method-name');

expect(nullResponse, isNull);
});
Expand Down

0 comments on commit 242bef2

Please sign in to comment.