Add an editable menu name and reserve billing material numbers on creation
- Company details get an optional "Valikon nimi", shown at the left of the main menu; it falls back to the application name when empty. - A billing material gets its running number (billing_exports.number) only when it is created, so discarded drafts leave no gaps. Drafts have no number; existing created materials are numbered by the migration, and the CSV file name uses the number. - TaskAssigneeMigrationTest rolls back from its own migration onward instead of assuming it is the last one. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -51,3 +51,38 @@ it('keeps everyone but the admin out', function () {
|
||||
|
||||
$this->get(route('settings.company'))->assertForbidden();
|
||||
});
|
||||
|
||||
it('saves the menu name and shows it at the left of the main menu', function () {
|
||||
$this->actingAs(User::factory()->admin()->create());
|
||||
|
||||
Livewire::test('shared::company')
|
||||
->set('name', 'Mediatalo Oy')
|
||||
->set('menu_name', ' Mediatalo Työt ')
|
||||
->set('business_id', '0737546-2')
|
||||
->call('save')
|
||||
->assertHasNoErrors();
|
||||
|
||||
expect(app(CompanyDetailsStore::class)->menuName())->toBe('Mediatalo Työt');
|
||||
|
||||
Livewire::test('shared::company')->assertSet('menu_name', 'Mediatalo Työt');
|
||||
|
||||
$this->get(route('customers.index'))->assertSee('Mediatalo Työt');
|
||||
});
|
||||
|
||||
it('falls back to the application name when the menu name is empty, even before other details are saved', function () {
|
||||
$store = app(CompanyDetailsStore::class);
|
||||
|
||||
expect($store->get())->toBeNull()
|
||||
->and($store->menuName())->toBe(config('app.name'));
|
||||
});
|
||||
|
||||
it('rejects a menu name over 100 characters', function () {
|
||||
$this->actingAs(User::factory()->admin()->create());
|
||||
|
||||
Livewire::test('shared::company')
|
||||
->set('name', 'Mediatalo Oy')
|
||||
->set('business_id', '0737546-2')
|
||||
->set('menu_name', str_repeat('a', 101))
|
||||
->call('save')
|
||||
->assertHasErrors(['menu_name' => [__('company.errors.menu_name')]]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user