forked from eatvio/eatvio_app
56 lines
1.5 KiB
Dart
56 lines
1.5 KiB
Dart
import 'package:eatvio_app/features/recipe/models/my_recipe_model.dart';
|
||
import 'package:flutter_test/flutter_test.dart';
|
||
|
||
void main() {
|
||
group('MyRecipeModel', () {
|
||
test('создает MyRecipeModel с правильными значениями', () {
|
||
const model = MyRecipeModel(
|
||
id: 1,
|
||
image: 'https://example.com/image.jpg',
|
||
state: 'active',
|
||
cookingTime: 30,
|
||
activeCookingTime: 15,
|
||
description: 'Test description',
|
||
steps: null,
|
||
videoUrl: null,
|
||
title: 'Test Recipe',
|
||
slug: 'test-recipe',
|
||
calories: 300.0,
|
||
likesCount: 10,
|
||
viewsCount: 100,
|
||
);
|
||
|
||
expect(model.id, 1);
|
||
expect(model.title, 'Test Recipe');
|
||
expect(model.slug, 'test-recipe');
|
||
expect(model.calories, 300.0);
|
||
});
|
||
});
|
||
|
||
group('MyRecipePaginationModel', () {
|
||
test('создает MyRecipePaginationModel с правильными значениями', () {
|
||
const recipe = MyRecipeModel(
|
||
id: 1,
|
||
image: 'https://example.com/image.jpg',
|
||
state: 'active',
|
||
cookingTime: 30,
|
||
activeCookingTime: 15,
|
||
description: 'Test description',
|
||
steps: null,
|
||
videoUrl: null,
|
||
title: 'Test Recipe',
|
||
slug: 'test-recipe',
|
||
calories: 300.0,
|
||
likesCount: 10,
|
||
viewsCount: 100,
|
||
);
|
||
|
||
const pagination = MyRecipePaginationModel(data: [recipe]);
|
||
|
||
expect(pagination.data.length, 1);
|
||
expect(pagination.data.first.id, 1);
|
||
});
|
||
});
|
||
}
|
||
|