Skip to content

Commit

Permalink
chore: write tests for side menu screen (#61)
Browse files Browse the repository at this point in the history
- grammar fixes
  • Loading branch information
markgravity committed Jun 29, 2021
1 parent fe1910b commit 9d842a1
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ void main() {
interactor.delegate = delegate;
});

describe("its resetPassword is called", () {
describe("its resetPassword() is called", () {
context("when authRepository's resetPassword return success", () {
beforeEach(() {
when(authRepository.resetPassword(email: anyNamed("email")))
.thenAnswer((realInvocation) => Future.value(null));
interactor.resetPassword(email: "email");
});

it("trigger delegate's passwordDidReset emits", () {
it("trigger delegate's passwordDidReset to emit", () {
expect(delegate.passwordDidReset, emits(null));
});
});
Expand All @@ -53,7 +53,7 @@ void main() {
interactor.resetPassword(email: "email");
});

it("trigger delegate's passwordDidFailToReset emits", () {
it("trigger delegate's passwordDidFailToReset to emit", () {
expect(delegate.passwordDidFailToReset, emits(exception));
});
});
Expand Down
4 changes: 2 additions & 2 deletions test/modules/forgot_password/forgot_password_view_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void main() {
await tester.tap(find.byKey(ForgotPasswordView.resetButtonKey));
});

it("triggers delegate's resetButtonDidTap emits", (tester) async {
it("triggers delegate's resetButtonDidTap to emit", (tester) async {
expect(delegate.resetButtonDidTap, emits(""));
});
});
Expand All @@ -159,7 +159,7 @@ void main() {
find.byKey(ForgotPasswordView.emailTextFieldKey), text);
});

it("triggers delegate's emailTextFieldDidChange emits", (tester) async {
it("triggers delegate's emailTextFieldDidChange to emit", (tester) async {
expect(delegate.emailTextFieldDidChange, emits(text));
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/modules/home/home_module_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void main() {
module = HomeModule();
});

describe("its build is called", () {
describe("its build() is called", () {
late Widget widget;

beforeEach(() {
Expand Down
6 changes: 3 additions & 3 deletions test/modules/home/home_presenter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void main() {
});
});

describe("it's sideMenuDidShow emits", () {
describe("its sideMenuDidShow emits", () {
beforeEach(() {
presenter.sideMenuDidShow.add(null);
});
Expand All @@ -182,7 +182,7 @@ void main() {
});
});

describe("it's sideMenuDidDismiss emits", () {
describe("its sideMenuDidDismiss emits", () {
beforeEach(() {
presenter.sideMenuDidDismiss.add(null);
});
Expand All @@ -192,7 +192,7 @@ void main() {
});
});

describe("it's userAvatarButtonDidTap emits", () {
describe("its userAvatarButtonDidTap emits", () {
beforeEach(() {
presenter.userAvatarButtonDidTap.add(null);
});
Expand Down
12 changes: 6 additions & 6 deletions test/modules/home/home_view_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,14 @@ void main() {
});
});

describe("it's showSideMenu() is called", () {
describe("its showSideMenu() is called", () {
beforeEach((tester) async {
await tester.pumpAndSettle();
module.view.showSideMenu();
await tester.pumpAndSettle();
});

it("triggers delegate's sideMenuDidShow emits", (tester) async {
it("triggers delegate's sideMenuDidShow to emit", (tester) async {
expect(delegate.sideMenuDidShow, emits(null));
});

Expand All @@ -263,24 +263,24 @@ void main() {
await tester.pumpAndSettle();
});

it("triggers delegate's sideMenuDidDismiss emits", (tester) async {
it("triggers delegate's sideMenuDidDismiss to emit", (tester) async {
expect(delegate.sideMenuDidDismiss, emits(null));
});
});
});

describe("it's user avatar button is tapped", () {
describe("its user avatar button is tapped", () {
beforeEach((tester) async {
await tester.pumpAndSettle();
await tester.tap(find.byKey(HomeView.userAvatarButtonKey));
});

it("triggers delegate's userAvatarButtonDidTap emits", (tester) async {
it("triggers delegate's userAvatarButtonDidTap to emit", (tester) async {
expect(delegate.userAvatarButtonDidTap, emits(null));
});
});

describe("it's setUserInteractionEnable() is called", () {
describe("its setUserInteractionEnable() is called", () {
beforeEach((tester) async {
module.view.setUserInteractionEnable(isEnabled: false);
await tester.pumpAndSettle();
Expand Down
5 changes: 3 additions & 2 deletions test/modules/landing/landing_interactor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void main() {
interactor.validateAuthentication();
});

it("triggers delegate's didValidateAuthentication emits true", () {
it("triggers delegate's didValidateAuthentication to emit true", () {
expect(delegate.authenticationDidValidate, emits(true));
});
});
Expand All @@ -57,7 +57,8 @@ void main() {
interactor.validateAuthentication();
});

it("triggers delegate's didValidateAuthentication emits error", () {
it("triggers delegate's didValidateAuthentication to emit an error",
() {
expect(delegate.authenticationDidFailToValidate, emits(error));
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/modules/login/login_interactor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void main() {
interactor.login("email", "password");
});

it("triggers delegate's didLogin emits", () {
it("triggers delegate's didLogin to emit", () {
expect(delegate.didLogin, emits(null));
});
});
Expand Down
9 changes: 5 additions & 4 deletions test/modules/login/login_view_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void main() {
await tester.enterText(find.byKey(LoginView.emailTextFieldKey), text);
});

it("triggers to delegate's didChangeEmailText emits", (tester) async {
it("triggers to delegate's didChangeEmailText to emit", (tester) async {
expect(delegate.emailTextFieldDidChange, emits(text));
});
});
Expand All @@ -168,7 +168,8 @@ void main() {
find.byKey(LoginView.passwordTextFieldKey), text);
});

it("triggers to delegate's didChangePasswordText emits", (tester) async {
it("triggers to delegate's didChangePasswordText to emit",
(tester) async {
expect(delegate.passwordTextFieldDidChange, emits(text));
});
});
Expand All @@ -182,7 +183,7 @@ void main() {
await tester.tap(find.byKey(LoginView.loginButtonKey));
});

it("triggers to delegate's didTapLoginButton emits", (tester) async {
it("triggers to delegate's didTapLoginButton to emit", (tester) async {
expect(delegate.loginButtonDidTap, emits(["", ""]));
});
});
Expand All @@ -195,7 +196,7 @@ void main() {
await tester.tap(find.byKey(LoginView.forgotButtonKey));
});

it("triggers to delegate's didTapLoginButton emits", (tester) async {
it("triggers to delegate's didTapLoginButton to emit", (tester) async {
expect(delegate.forgotButtonDidTap, emits(null));
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/modules/side_menu/side_menu_module_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void main() {
module = SideMenuModule();
});

describe("its build is called", () {
describe("its build() is called", () {
late Widget widget;

beforeEach(() {
Expand Down

0 comments on commit 9d842a1

Please sign in to comment.