Created
November 4, 2017 21:53
-
-
Save alexd1971/1453df978f2337c66318abccc15d4589 to your computer and use it in GitHub Desktop.
Unexplained async behaviour
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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