testing repeater / fillForm / fill default item

Hi - I'm just getting started writing tests for my app with Pest. My first and most high-traffic resource has a repeater on it, which shows 1 instance by default. When I run fillForm() and pass in one instance of a repeater record, I end up with 2 instances. Thanks in advance for any advice!

    $create = livewire(QuoteRequestResource\Pages\CreateQuoteRequest::class)
        ->fillForm([
            'client_id' => 10,
            'policies' => [
                $policy
            ]
        ])
        ->call('create');
        // ->assertHasNoFormErrors(); //fails

the form has this repeater:
Forms\Components\Repeater::make('policies')
            ->relationship()
            ->schema([
                Forms\Components\Hidden::make('partner_id')
                    ->default(Filament::getTenant()->id),
                Forms\Components\Hidden::make('client_id'),
                Forms\Components\Select::make('policy_type_id')
                    ->label('Policy Type')
                    ->columnSpan(3)
                    ->options(PolicyType::all()->pluck('name', 'id'))
                    ->required(),
                    //...
            ])
            ->addActionLabel('Add Another Policy')
            ->defaultItems(1)

the testing db ends up with 2 policy instances
// validation issue is w a 2nd policy inst - why is it there?
    dd(QuoteRequest::with('policies')->get()->toArray());
Was this page helpful?