test: coverage

pull/416/head
RuiAlonso 3 years ago
parent f587911651
commit a3b03976e3

@ -22,6 +22,52 @@ void main() {
); );
}); });
group('onProgressed', () {
blocTest<SpaceshipRampCubit, SpaceshipRampState>(
'emits next arrow lightState',
build: SpaceshipRampCubit.new,
act: (bloc) => bloc
..onProgressed()
..onProgressed()
..onProgressed()
..onProgressed()
..onProgressed()
..onProgressed(),
expect: () => [
isA<SpaceshipRampState>().having(
(state) => state.lightState,
'lightState',
ArrowLightState.active1,
),
isA<SpaceshipRampState>().having(
(state) => state.lightState,
'lightState',
ArrowLightState.active2,
),
isA<SpaceshipRampState>().having(
(state) => state.lightState,
'lightState',
ArrowLightState.active3,
),
isA<SpaceshipRampState>().having(
(state) => state.lightState,
'lightState',
ArrowLightState.active4,
),
isA<SpaceshipRampState>().having(
(state) => state.lightState,
'lightState',
ArrowLightState.active5,
),
isA<SpaceshipRampState>().having(
(state) => state.lightState,
'lightState',
ArrowLightState.inactive,
),
],
);
});
group('onReset', () { group('onReset', () {
blocTest<SpaceshipRampCubit, SpaceshipRampState>( blocTest<SpaceshipRampCubit, SpaceshipRampState>(
'emits state reset to initial values', 'emits state reset to initial values',

@ -30,7 +30,6 @@ void main() {
isNotNull, isNotNull,
); );
}); });
});
test( test(
'throws AssertionError ' 'throws AssertionError '
@ -45,6 +44,23 @@ void main() {
); );
}, },
); );
});
test(
'fullArrowLit returns if lightState is last one',
() {
expect(
SpaceshipRampState.initial().fullArrowLit,
isFalse,
);
expect(
SpaceshipRampState.initial()
.copyWith(lightState: ArrowLightState.active5)
.fullArrowLit,
isTrue,
);
},
);
group('copyWith', () { group('copyWith', () {
test( test(

Loading…
Cancel
Save