feat(tests): add a test for the CardSwiperController
This commit is contained in:
parent
8990e9e888
commit
6e7e8a78fe
|
|
@ -51,7 +51,6 @@ linter:
|
|||
- camel_case_extensions
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
- cascade_invocations
|
||||
- cast_nullable_to_non_nullable
|
||||
- close_sinks
|
||||
- collection_methods_unrelated_type
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
import 'package:flutter_card_swiper/src/card_swiper_controller.dart';
|
||||
import 'package:flutter_card_swiper/src/enums.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('CardSwiperController', () {
|
||||
test('swipe() changes state to swipe', () {
|
||||
final controller = CardSwiperController();
|
||||
controller.swipe();
|
||||
expect(controller.state, CardSwiperState.swipe);
|
||||
});
|
||||
|
||||
test('swipeLeft() changes state to swipeLeft', () {
|
||||
final controller = CardSwiperController();
|
||||
controller.swipeLeft();
|
||||
expect(controller.state, CardSwiperState.swipeLeft);
|
||||
});
|
||||
|
||||
test('swipeRight() changes state to swipeRight', () {
|
||||
final controller = CardSwiperController();
|
||||
controller.swipeRight();
|
||||
expect(controller.state, CardSwiperState.swipeRight);
|
||||
});
|
||||
|
||||
test('swipeTop() changes state to swipeTop', () {
|
||||
final controller = CardSwiperController();
|
||||
controller.swipeTop();
|
||||
expect(controller.state, CardSwiperState.swipeTop);
|
||||
});
|
||||
|
||||
test('swipeBottom() changes state to swipeBottom', () {
|
||||
final controller = CardSwiperController();
|
||||
controller.swipeBottom();
|
||||
expect(controller.state, CardSwiperState.swipeBottom);
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue