diff --git a/README.md b/README.md index f9b907bf..6fe8705f 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,6 @@ Link to the [Penpot Project](https://design.penpot.app/#/workspace/43442e9d-d45f ### Project Architecture Diagram -Here is the first architecture diagram of the application for MS1. This should give a quick reference/overview on the overall architecture and the relations between the different screens, data sources, and internal state of the application. Proxima Arichtecture Diagram diff --git a/test/models/ui/validation/create_account_validation_test.dart b/test/models/ui/validation/create_account_validation_test.dart index 53baac55..0976dc56 100644 --- a/test/models/ui/validation/create_account_validation_test.dart +++ b/test/models/ui/validation/create_account_validation_test.dart @@ -34,7 +34,55 @@ void main() { accountCreated: true, ); - expect(createAccount, createAccountCopy); + expect(createAccount == createAccountCopy, true); + }); + + test("equality fails on different uniqueUsernameError", () { + const createAccount = CreateAccountValidation( + uniqueUsernameError: "uniqueUsernameError", + pseudoError: "pseudoError", + accountCreated: true, + ); + + const createAccountCopy = CreateAccountValidation( + uniqueUsernameError: "uniqueUsernameError2", + pseudoError: "pseudoError", + accountCreated: true, + ); + + expect(createAccount == createAccountCopy, false); + }); + + test("equality fails on different pseudoError", () { + const createAccount = CreateAccountValidation( + uniqueUsernameError: "uniqueUsernameError", + pseudoError: "pseudoError", + accountCreated: true, + ); + + const createAccountCopy = CreateAccountValidation( + uniqueUsernameError: "uniqueUsernameError", + pseudoError: "pseudoError2", + accountCreated: true, + ); + + expect(createAccount == createAccountCopy, false); + }); + + test("equality fails on different accountCreated", () { + const createAccount = CreateAccountValidation( + uniqueUsernameError: "uniqueUsernameError", + pseudoError: "pseudoError", + accountCreated: true, + ); + + const createAccountCopy = CreateAccountValidation( + uniqueUsernameError: "uniqueUsernameError", + pseudoError: "pseudoError", + accountCreated: false, + ); + + expect(createAccount == createAccountCopy, false); }); }); } diff --git a/test/models/ui/validation/new_comment_validation_test.dart b/test/models/ui/validation/new_comment_validation_test.dart new file mode 100644 index 00000000..a2ac139c --- /dev/null +++ b/test/models/ui/validation/new_comment_validation_test.dart @@ -0,0 +1,68 @@ +import "package:flutter_test/flutter_test.dart"; +import "package:proxima/models/ui/validation/new_comment_validation.dart"; + +void main() { + group("New Comment Model Testing", () { + test("hash overrides correctly", () { + // Define the expected result + const newCommentState = NewCommentValidation( + contentError: "contentError", + posted: true, + ); + + final expectedHash = Object.hash( + newCommentState.contentError, + newCommentState.posted, + ); + + final actualHash = newCommentState.hashCode; + + expect(actualHash, expectedHash); + }); + + test("equality overrides correctly", () { + // Define the expected result + const newCommentState = NewCommentValidation( + contentError: "commentError", + posted: true, + ); + + const newCommentStateCopy = NewCommentValidation( + contentError: "commentError", + posted: true, + ); + + expect(newCommentState == newCommentStateCopy, true); + }); + + test("equality fails on different contentError", () { + // Define the expected result + const newCommentState = NewCommentValidation( + contentError: "commentError", + posted: true, + ); + + const newCommentStateCopy = NewCommentValidation( + contentError: "commentError2", + posted: true, + ); + + expect(newCommentState == newCommentStateCopy, false); + }); + + test("equality fails on different posted", () { + // Define the expected result + const newCommentState = NewCommentValidation( + contentError: "commentError", + posted: true, + ); + + const newCommentStateCopy = NewCommentValidation( + contentError: "commentError", + posted: false, + ); + + expect(newCommentState == newCommentStateCopy, false); + }); + }); +} diff --git a/test/models/ui/validation/new_post_validation_test.dart b/test/models/ui/validation/new_post_validation_test.dart index 13ab0049..76b3a70a 100644 --- a/test/models/ui/validation/new_post_validation_test.dart +++ b/test/models/ui/validation/new_post_validation_test.dart @@ -2,7 +2,7 @@ import "package:flutter_test/flutter_test.dart"; import "package:proxima/models/ui/validation/new_post_validation.dart"; void main() { - group("Create Account Model testing", () { + group("New Post Model testing", () { test("hash overrides correctly", () { final newPostState = NewPostValidation( titleError: "titleError",