ajwah_bloc_test 0.1.1+2 copy "ajwah_bloc_test: ^0.1.1+2" to clipboard
ajwah_bloc_test: ^0.1.1+2 copied to clipboard

A Dart package that makes testing ajwah_bloc easy.

example/README.md

import 'package:ajwah_bloc/ajwah_bloc.dart';

import 'package:ajwah_bloc_test/ajwah_bloc_test.dart';

import "package:test/test.dart";

import 'actionTypes.dart';
import 'counterStateController.dart';

void main() {
  CounterStateController controller = CounterStateController();

  setUpAll(() {});

  tearDownAll(() {
    controller.dispose();
  });

  ajwahTest("initial store should be:{count:0, isLoading:false}",
      build: () => controller.stream$, expect: [CounterModel.init()]);

  ajwahTest<CounterModel>(
      "after dispatch(actionType: ActionTypes.Inc) state should be:{count:1, isLoading:false}",
      build: () => controller.stream$,
      act: () => dispatch(Action(type: ActionTypes.Inc)),
      skip: 1,
      verify: (models) {
        expect(models[0].count, 1);
      },
      expect: [CounterModel(count: 1, isLoading: false)]);

  ajwahTest(
    "after dispatch(actionType: ActionTypes.Dec) state should be:{count:0, isLoading:false}",
    act: () => dispatch(Action(type: ActionTypes.Dec)),
    build: () => controller.stream$,
    skip: 1,
    expect: [CounterModel.init()],
  );
}



0
likes
130
pub points
0%
popularity

Publisher

unverified uploader

A Dart package that makes testing ajwah_bloc easy.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (LICENSE)

Dependencies

meta, test

More

Packages that depend on ajwah_bloc_test