Commit 6185fa14 authored by Matt Perry's avatar Matt Perry

Remove use of FakeAsync in signing_test.dart

parent 84b740a4
......@@ -6,7 +6,6 @@ import 'package:bignum/bignum.dart';
import 'package:cipher/cipher.dart' hide CipherParameters;
import 'package:crypto/crypto.dart';
import 'package:flx/signing.dart';
import 'package:quiver/testing/async.dart';
import 'package:test/test.dart';
main() async {
......@@ -97,33 +96,19 @@ main() async {
expect(verifies, equals(false), reason: failReason);
});
test('verifyContentHash works', () {
new FakeAsync().run((FakeAsync async) {
bool verifies;
Stream contentStream = new Stream.fromIterable(kTestBytesList);
verifyContentHash(new BigInteger(kTestHash), contentStream).then((bool rv) {
verifies = rv;
});
async.elapse(Duration.ZERO);
expect(verifies, equals(true));
// Ensure it fails with invalid hash or content.
verifies = null;
contentStream = new Stream.fromIterable(kTestBytesList);
verifyContentHash(new BigInteger(0xdeadbeef), contentStream).then((bool rv) {
verifies = rv;
});
async.elapse(Duration.ZERO);
expect(verifies, equals(false));
verifies = null;
Stream badContentStream =
new Stream.fromIterable([new Uint8List.fromList(<int>[42])]);
verifyContentHash(new BigInteger(kTestHash), badContentStream).then((bool rv) {
verifies = rv;
});
async.elapse(Duration.ZERO);
expect(verifies, equals(false));
});
test('verifyContentHash works', () async {
Stream contentStream = new Stream.fromIterable(kTestBytesList);
bool verifies = await verifyContentHash(new BigInteger(kTestHash), contentStream);
expect(verifies, equals(true));
// Ensure it fails with invalid hash or content.
contentStream = new Stream.fromIterable(kTestBytesList);
verifies = await verifyContentHash(new BigInteger(0xdeadbeef), contentStream);
expect(verifies, equals(false));
Stream badContentStream =
new Stream.fromIterable([new Uint8List.fromList(<int>[42])]);
verifies = await verifyContentHash(new BigInteger(kTestHash), badContentStream);
expect(verifies, equals(false));
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment