Confusing failure with nested mocks
- Lenguaje dominante
- Dart
- Estrellas
- 702
- Forks
- 88
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.