feat(frontend): require landlord profile completion
This commit is contained in:
1 parent
983a080cc7
commit
12316b8604
18 files changed
+838
-217
No files matched your search
@@ -48,24 +48,13 @@ describe('SettingsPage', () => {
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(fixture.nativeElement.querySelector('input#firstName').value).toBe('Camille');
|
||||
expect(fixture.nativeElement.querySelector('input#email').value).toBe('camille@example.com');
|
||||
expect(fixture.nativeElement.querySelector('input#address').value).toBe('1 rue de Paris');
|
||||
});
|
||||
|
||||
it('shows a useful error instead of saving an incomplete profile', () => {
|
||||
const fixture = TestBed.createComponent(SettingsPage);
|
||||
fixture.detectChanges();
|
||||
const component = fixture.componentInstance;
|
||||
component.profileModel.update((p) => ({ ...p, phone: '' }));
|
||||
|
||||
component.save();
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(fixture.nativeElement.textContent).toContain(
|
||||
'Veuillez renseigner tous les champs obligatoires.',
|
||||
expect(fixture.nativeElement.querySelector('input#profile-firstName').value).toBe('Camille');
|
||||
expect(fixture.nativeElement.querySelector('input#profile-email').value).toBe(
|
||||
'camille@example.com',
|
||||
);
|
||||
expect(fixture.nativeElement.querySelector('input#profile-address').value).toBe(
|
||||
'1 rue de Paris',
|
||||
);
|
||||
expect(profile.updateProfile).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('keeps the entered values and explains a rejected profile save', async () => {
|
||||
@@ -80,10 +69,13 @@ describe('SettingsPage', () => {
|
||||
);
|
||||
const fixture = TestBed.createComponent(SettingsPage);
|
||||
fixture.detectChanges();
|
||||
const component = fixture.componentInstance;
|
||||
component.profileModel.update((p) => ({ ...p, email: 'alex@example.com' }));
|
||||
await fixture.whenStable();
|
||||
const email = fixture.nativeElement.querySelector('input#profile-email') as HTMLInputElement;
|
||||
email.value = 'alex@example.com';
|
||||
email.dispatchEvent(new Event('input'));
|
||||
fixture.detectChanges();
|
||||
|
||||
component.save();
|
||||
fixture.nativeElement.querySelector('button.primary-action').click();
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
@@ -95,6 +87,8 @@ describe('SettingsPage', () => {
|
||||
address: '1 rue de Paris',
|
||||
});
|
||||
expect(fixture.nativeElement.textContent).toContain('Cette adresse e-mail est déjà utilisée.');
|
||||
expect(fixture.nativeElement.querySelector('input#email').value).toBe('alex@example.com');
|
||||
expect(fixture.nativeElement.querySelector('input#profile-email').value).toBe(
|
||||
'alex@example.com',
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user