Testing edit form with repeater

Hello I want to test if my form is filled with the retrieved data. But I always get Failed asserting that null matches expected '200g'.

This is my test:
it('can fill in the edit page with retrieved data', function (){
    // Arrange
    $recipe = Recipe::factory()
        ->has(RecipeIngredient::factory(2), 'ingredients')
        ->create();

    // Act & Assert
    livewire(RecipeResource\Pages\EditRecipe::class, [
        'record' => $recipe->getRouteKey(),
    ])
        ->assertFormSet([
            'title' => [
                'nl' => $recipe->title,
                'en' => $recipe->title,
                'fr' => $recipe->title,
            ],
            'recipe_ingredients' => $recipe->ingredients()->get()->map(function ($ingredient) {
                return [
                    'quantity' => $ingredient->quantity,
                    'ingredient_id' => $ingredient->ingredient_id,
                ];
            })->toArray()
        ]);
});


This is my form:
Section::make('Ingrediënten')
                ->schema([
                    Repeater::make('recipe_ingredients')
                        ->label('')
                        ->relationship('ingredients')
                        ->schema([
                            TextInput::make('quantity')
                                ->label('Hoeveelheid')
                                ->required(),
                            Select::make('ingredient_id')
                                ->relationship('ingredient', 'name')
                                ->preload()
                                ->searchable()
                                ->label('Naam')
                                ->required(),
                        ])->columns(2),
                ]),


How can I fix my test? Or is it something that I do completely wrong?
Was this page helpful?