-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
118 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
test/models/ui/validation/new_comment_validation_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters