Confusing failure with nested mocks
- Langage dominant
- Dart
- Étoiles
- 702
- Forks
- 88
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
I meant to file this a few weeks ago, sorry.
```dart
import 'package:mocktail/mocktail.dart';
import 'package:test/test.dart';
class One {
final Two two = Two();
}
class Two {
final String three = '';
}
class _MockOne extends Mock implements One {}
class _MockTwo extends Mock implements Two {}
void main() {
test('nested mocks', () {
final one = _MockOne();
final two = _MockTwo();
when(() => one.two).thenReturn(two);
when(() => one.two.three).thenReturn('three');
expect(one.two.three, 'three');
});
}
```
```
00:02 +0 -1: nested mocks [E]
type 'String' is not a subtype of type 'Two'
test/foo_test.dart 12:7 _MockOne.two
test/foo_test.dart 22:16 main.
```
That's a better error than I remember (I remember it being silent?) But it's still pretty confusing. Feel free to close.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.