forked from eatvio/eatvio_app
45 lines
1.2 KiB
Dart
45 lines
1.2 KiB
Dart
import 'package:eatvio_app/features/create_recipe/models/step.dart';
|
||
import 'package:flutter_test/flutter_test.dart';
|
||
|
||
void main() {
|
||
group('Step', () {
|
||
test('создает Step с правильными значениями', () {
|
||
const step = Step(
|
||
image: 'https://example.com/image.jpg',
|
||
description: 'Test step description',
|
||
);
|
||
|
||
expect(step.image, 'https://example.com/image.jpg');
|
||
expect(step.description, 'Test step description');
|
||
});
|
||
|
||
test('создает Step с null значениями', () {
|
||
const step = Step();
|
||
|
||
expect(step.image, isNull);
|
||
expect(step.description, isNull);
|
||
});
|
||
|
||
test('fromJson создает Step из JSON', () {
|
||
final json = {
|
||
'image': 'https://example.com/image.jpg',
|
||
'description': 'Test step description',
|
||
};
|
||
|
||
final step = Step.fromJson(json);
|
||
|
||
expect(step.image, 'https://example.com/image.jpg');
|
||
expect(step.description, 'Test step description');
|
||
});
|
||
|
||
test('fromJson создает Step из JSON с null значениями', () {
|
||
final json = <String, dynamic>{};
|
||
|
||
final step = Step.fromJson(json);
|
||
|
||
expect(step.image, isNull);
|
||
expect(step.description, isNull);
|
||
});
|
||
});
|
||
}
|