initial commit (migrated)
This commit is contained in:
commit
b594facb51
143 changed files with 11057 additions and 0 deletions
|
|
@ -0,0 +1,35 @@
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fpdart/fpdart.dart';
|
||||
import 'package:kuwot/core/domain/no_params.dart';
|
||||
import 'package:kuwot/features/quote/domain/entities/translation.dart';
|
||||
import 'package:kuwot/features/quote/domain/repositories/quote_repository.dart';
|
||||
import 'package:kuwot/features/quote/domain/use_cases/get_translations.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
|
||||
class MockQuoteRepository extends Mock implements QuoteRepository {}
|
||||
|
||||
void main() {
|
||||
late MockQuoteRepository mockQuoteRepository;
|
||||
late GetTranslations useCase;
|
||||
|
||||
setUp(() {
|
||||
mockQuoteRepository = MockQuoteRepository();
|
||||
useCase = GetTranslations(mockQuoteRepository);
|
||||
});
|
||||
|
||||
test('should get translations', () async {
|
||||
// arrange
|
||||
final tExpected = <Translation>[];
|
||||
when(
|
||||
() => mockQuoteRepository.getTranslations(),
|
||||
).thenAnswer((_) async => right(tExpected));
|
||||
|
||||
// act
|
||||
final result = await useCase(const NoParams());
|
||||
|
||||
// assert
|
||||
expect(result, right(tExpected));
|
||||
verify(() => mockQuoteRepository.getTranslations());
|
||||
verifyNoMoreInteractions(mockQuoteRepository);
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue