mirror of https://github.com/flutter/pinball.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
890 B
34 lines
890 B
// Copyright (c) 2021, Very Good Ventures
|
|
// https://verygood.ventures
|
|
//
|
|
// Use of this source code is governed by an MIT-style
|
|
// license that can be found in the LICENSE file or at
|
|
// https://opensource.org/licenses/MIT.
|
|
|
|
import 'package:bloc_test/bloc_test.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:pinball/counter/counter.dart';
|
|
|
|
void main() {
|
|
group('CounterCubit', () {
|
|
test('initial state is 0', () {
|
|
expect(CounterCubit().state, equals(0));
|
|
});
|
|
|
|
blocTest<CounterCubit, int>(
|
|
'emits [1] when increment is called',
|
|
build: CounterCubit.new,
|
|
act: (cubit) => cubit.increment(),
|
|
expect: () => [equals(1)],
|
|
);
|
|
|
|
blocTest<CounterCubit, int>(
|
|
'emits [-1] when decrement is called',
|
|
build: CounterCubit.new,
|
|
act: (cubit) => cubit.decrement(),
|
|
expect: () => [equals(-1)],
|
|
);
|
|
});
|
|
}
|