Skip to content

Commit

Permalink
Fix janky throw tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gching committed Mar 22, 2018
1 parent f10895e commit 1129e8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 3 additions & 8 deletions test/byte_polynomial_test.dart
Expand Up @@ -118,17 +118,12 @@ void main() {
test('Should throw given a bad x coordinate', () {
expect(() => _poly.evaluateAtX(-1), throwsArgumentError);
});

test('Should throw if not generated', () {
_poly = new BytePolynomial(5);
expect(() => _poly.evaluateAtX(5), throwsA(NotGeneratedException));
}, skip: 'Testing custom exception are still janky.');

test('Should throw given that coefficients have not been generated', () {
BytePolynomial _badPoly = new BytePolynomial(0);
expect(() => _badPoly.evaluateAtX(0),
throwsA(equals("NotGeneratedException")));
}, skip: 'Something is janky about testing exceptions');
expect(() => _badPoly.evaluateAtX(5),
throwsA(new isInstanceOf<NotGeneratedException>()));
});

test('Should return the constant value given x = 0', () {
expect(_poly.evaluateAtX(0), equals(1));
Expand Down
2 changes: 1 addition & 1 deletion test/secret_scheme_test.dart
Expand Up @@ -71,7 +71,7 @@ void main() {

badXVal[256] = new List();
badYVal[5] = null;

expect(() => ss.combineShares(null), throwsArgumentError);
expect(() => ss.combineShares(empty), throwsArgumentError);
expect(() => ss.combineShares(badXVal), throwsArgumentError);
Expand Down

0 comments on commit 1129e8d

Please sign in to comment.