<?php

use App\Models\Member;

test('factory does not set member_number, since the observer owns it', function () {
    $factoryAttributes = Member::factory()->make()->getAttributes();

    expect($factoryAttributes)->not->toHaveKey('member_number');
});

test('the observer backfills member_number on create', function () {
    $member = Member::factory()->create();

    expect($member->member_number)->toBe('M'.str_pad((string) $member->id, 8, '0', STR_PAD_LEFT));
});
