S16 postgresql opslag added
All checks were successful
Build, test and publish / verify (push) Successful in 7m31s
All checks were successful
Build, test and publish / verify (push) Successful in 7m31s
This commit is contained in:
@@ -50,11 +50,33 @@ describe('EntityEditor', () => {
|
||||
const saved = vi.fn();
|
||||
component.saved.subscribe(saved);
|
||||
await component.save();
|
||||
expect(api.saveSchool).toHaveBeenCalledWith({ name: 'Studio' }, undefined);
|
||||
expect(api.saveSchool).toHaveBeenCalledWith({ name: 'Studio' }, undefined, undefined);
|
||||
expect(saved).toHaveBeenCalledOnce();
|
||||
expect(component.busy()).toBe(false);
|
||||
});
|
||||
|
||||
it('retains the revision from opening the editor across background refreshes', async () => {
|
||||
api.saveDancer.mockReturnValue(of({ id: 3 }));
|
||||
const fixture = TestBed.createComponent(EntityEditor);
|
||||
fixture.componentRef.setInput('target', {
|
||||
kind: 'dancer',
|
||||
value: { id: 3, name: 'Sam', birthDate: '2010-01-01' },
|
||||
});
|
||||
fixture.componentRef.setInput('schoolId', 7);
|
||||
fixture.componentRef.setInput('revision', 4);
|
||||
const component = fixture.componentInstance;
|
||||
component.ngOnInit();
|
||||
fixture.componentRef.setInput('revision', 5);
|
||||
component.name = 'Sam edited';
|
||||
await component.save();
|
||||
expect(api.saveDancer).toHaveBeenCalledWith(
|
||||
7,
|
||||
{ name: 'Sam edited', birthDate: '2010-01-01' },
|
||||
3,
|
||||
4,
|
||||
);
|
||||
});
|
||||
|
||||
it('keeps the editor open and preserves input when saving fails', async () => {
|
||||
api.saveSchool.mockReturnValue(throwError(() => new HttpErrorResponse({ status: 0 })));
|
||||
const component = editor({ kind: 'school' });
|
||||
@@ -116,6 +138,7 @@ describe('EntityEditor', () => {
|
||||
7,
|
||||
expect.objectContaining({ preferredDayParts: 1 }),
|
||||
undefined,
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user