Skip to content

Instantly share code, notes, and snippets.

@alexd1971
Created November 4, 2017 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexd1971/1453df978f2337c66318abccc15d4589 to your computer and use it in GitHub Desktop.
Save alexd1971/1453df978f2337c66318abccc15d4589 to your computer and use it in GitHub Desktop.
Unexplained async behaviour
@TestOn('browser');
import 'package:test/test.dart';
import 'package:http/browser_client.dart';
import 'package:http_exception/http_status.dart';
main() {
final http = new BrowserClient();
test('Http request', () async {
int start = new DateTime.now().millisecondsSinceEpoch;
final response = await http.get('http://localhost');
int duration = new DateTime.now().millisecondsSinceEpoch - start;
int result = DateTime.parse(response.body).millisecondsSinceEpoch;
expect(result, closeTo(start, duration);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment