|
|
|
|
@ -220,6 +220,59 @@ void main() {
|
|
|
|
|
throwsA(isA<Exception>()),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('creates a recipe with video URLs', () async {
|
|
|
|
|
final recipe = RecipeModel(
|
|
|
|
|
id: 'test-recipe-video',
|
|
|
|
|
title: 'Recipe with Video',
|
|
|
|
|
tags: ['video'],
|
|
|
|
|
imageUrls: ['https://example.com/image.jpg'],
|
|
|
|
|
videoUrls: ['https://example.com/video.mp4'],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final created = await recipeService.createRecipe(recipe);
|
|
|
|
|
|
|
|
|
|
expect(created.videoUrls, equals(['https://example.com/video.mp4']));
|
|
|
|
|
expect(created.videoUrls.length, equals(1));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('updates a recipe with video URLs', () async {
|
|
|
|
|
final recipe = RecipeModel(
|
|
|
|
|
id: 'test-recipe-video-update',
|
|
|
|
|
title: 'Original Recipe',
|
|
|
|
|
tags: ['test'],
|
|
|
|
|
videoUrls: ['https://example.com/video1.mp4'],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await recipeService.createRecipe(recipe);
|
|
|
|
|
|
|
|
|
|
final updated = recipe.copyWith(
|
|
|
|
|
videoUrls: ['https://example.com/video1.mp4', 'https://example.com/video2.mp4'],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final result = await recipeService.updateRecipe(updated);
|
|
|
|
|
|
|
|
|
|
expect(result.videoUrls.length, equals(2));
|
|
|
|
|
expect(result.videoUrls, contains('https://example.com/video1.mp4'));
|
|
|
|
|
expect(result.videoUrls, contains('https://example.com/video2.mp4'));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('retrieves recipe with video URLs from database', () async {
|
|
|
|
|
final recipe = RecipeModel(
|
|
|
|
|
id: 'test-recipe-video-retrieve',
|
|
|
|
|
title: 'Recipe with Videos',
|
|
|
|
|
tags: ['test'],
|
|
|
|
|
videoUrls: ['https://example.com/video1.mp4', 'https://example.com/video2.mp4'],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await recipeService.createRecipe(recipe);
|
|
|
|
|
final retrieved = await recipeService.getRecipe('test-recipe-video-retrieve');
|
|
|
|
|
|
|
|
|
|
expect(retrieved, isNotNull);
|
|
|
|
|
expect(retrieved!.videoUrls.length, equals(2));
|
|
|
|
|
expect(retrieved.videoUrls, contains('https://example.com/video1.mp4'));
|
|
|
|
|
expect(retrieved.videoUrls, contains('https://example.com/video2.mp4'));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|