@@ -143,7 +143,8 @@ void main() {
143
143
final timestamp = clock.now ().millisecondsSinceEpoch.toString ();
144
144
expect (sessionFile.readAsStringSync (), 'contents' );
145
145
analytics.userProperty.preparePayload ();
146
- expect (sessionFile.readAsStringSync (), '{"session_id": $timestamp }' );
146
+ expect (sessionFile.readAsStringSync (),
147
+ '{"session_id": $timestamp , "last_ping": $timestamp }' );
147
148
148
149
// Attempting to fetch the session id when malformed should also
149
150
// send an error event while parsing
@@ -199,7 +200,8 @@ void main() {
199
200
final timestamp = clock.now ().millisecondsSinceEpoch.toString ();
200
201
expect (sessionFile.existsSync (), false );
201
202
analytics.userProperty.preparePayload ();
202
- expect (sessionFile.readAsStringSync (), '{"session_id": $timestamp }' );
203
+ expect (sessionFile.readAsStringSync (),
204
+ '{"session_id": $timestamp , "last_ping": $timestamp }' );
203
205
204
206
// Attempting to fetch the session id when malformed should also
205
207
// send an error event while parsing
@@ -1031,6 +1033,14 @@ ${initialTool.label}=$dateStamp,$toolsMessageVersion
1031
1033
1032
1034
test ('Null values for flutter parameters is reflected properly in log file' ,
1033
1035
() {
1036
+ // Because we are using the `MemoryFileSystem.test` constructor,
1037
+ // we don't have a real clock in the filesystem, and because we
1038
+ // are checking the last modified timestamp for the session file
1039
+ // to determine if we need to update the session id, manually setting
1040
+ // that timestamp will ensure we are not updating session id when it
1041
+ // first gets created
1042
+ sessionFile.setLastModifiedSync (DateTime .now ());
1043
+
1034
1044
// Use a for loop two initialize the second analytics instance
1035
1045
// twice to account for no events being sent on the first instance
1036
1046
// run for a given tool
0 commit comments