https://github.com/bedirhanssaglam/mockify
Mockify is a Dart class used for mocking function calls and verifying method invocations in Flutter.
https://github.com/bedirhanssaglam/mockify
dart flutter mock mockito testing
Last synced: 2 months ago
JSON representation
Mockify is a Dart class used for mocking function calls and verifying method invocations in Flutter.
- Host: GitHub
- URL: https://github.com/bedirhanssaglam/mockify
- Owner: bedirhanssaglam
- Created: 2024-06-05T17:00:56.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-05T17:02:27.000Z (about 2 years ago)
- Last Synced: 2025-03-02T23:43:44.285Z (over 1 year ago)
- Topics: dart, flutter, mock, mockito, testing
- Language: Dart
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mockify
Mockify is a Dart class used for mocking function calls and verifying method invocations.
## Basic Example
```dart
void main() {
group('Calculator tests', () {
late Mockify mockify;
setUp(() {
mockify = Mockify();
});
test('Subtract method test with negative result', () {
mockify.when(#subtract, (args) => args[0] - args[1]);
final resultSubtract = mockify.call(#subtract, [2, 5]);
expect(resultSubtract, -3);
mockify.verify(#subtract, called: 1);
});
});
}
```
## Running Tests
To run tests, you can use the following command in the terminal at the root of project:
```bash
dart test
```
or
```bash
flutter test
```
These commands will find test files in project and report the test results.