From 1692532a4323e49ed911a64926d110a181ca4cc0 Mon Sep 17 00:00:00 2001 From: RuiAlonso Date: Thu, 10 Mar 2022 13:17:07 +0100 Subject: [PATCH] test: fixed tests for assertions --- packages/geometry/test/src/geometry_test.dart | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/geometry/test/src/geometry_test.dart b/packages/geometry/test/src/geometry_test.dart index a3040a9c..3a288f3f 100644 --- a/packages/geometry/test/src/geometry_test.dart +++ b/packages/geometry/test/src/geometry_test.dart @@ -1,7 +1,7 @@ // ignore_for_file: prefer_const_constructors, cascade_invocations import 'package:flame/extensions.dart'; -import 'package:flutter_test/flutter_test.dart'; import 'package:geometry/geometry.dart'; +import 'package:test/test.dart'; class Binomial { Binomial({required this.n, required this.k}); @@ -42,18 +42,18 @@ void main() { ], step: 2, ), - throwsAssertionError, + throwsA(const TypeMatcher()), ); }); test('fails if not enough control points', () { expect( () => calculateBezierCurve(controlPoints: [Vector2.zero()]), - throwsAssertionError, + throwsA(const TypeMatcher()), ); expect( () => calculateBezierCurve(controlPoints: []), - throwsAssertionError, + throwsA(const TypeMatcher()), ); }); @@ -81,15 +81,18 @@ void main() { group('binomial', () { test('fails if k is negative', () { - expect(() => binomial(1, -1), throwsAssertionError); + expect( + () => binomial(1, -1), throwsA(const TypeMatcher())); }); test('fails if n is negative', () { - expect(() => binomial(-1, 1), throwsAssertionError); + expect( + () => binomial(-1, 1), throwsA(const TypeMatcher())); }); test('fails if n < k', () { - expect(() => binomial(1, 2), throwsAssertionError); + expect( + () => binomial(1, 2), throwsA(const TypeMatcher())); }); test('for a specific input gives a correct value', () { @@ -131,7 +134,7 @@ void main() { group('factorial', () { test('fails if negative number', () { - expect(() => factorial(-1), throwsAssertionError); + expect(() => factorial(-1), throwsA(const TypeMatcher())); }); test('for a specific input gives a correct value', () {