S16 postgresql opslag added
All checks were successful
Build, test and publish / verify (push) Successful in 7m31s

This commit is contained in:
2026-11-04 17:10:25 +01:00
parent f59cad115a
commit 694bf3fa86
89 changed files with 3087 additions and 252 deletions

View File

@@ -18,13 +18,17 @@ describe('SchoolApi contract', () => {
it('loads all resources from the same school', () => {
const received = vi.fn();
api.schoolData(7).subscribe(received);
const school = { id: 7, name: 'Studio', dancerIds: [], danceGroupIds: [], showIds: [] };
http.expectOne('/api/dance-schools/7').flush(school);
http.expectOne('/api/dance-schools/7/dancers').flush([]);
http.expectOne('/api/dance-schools/7/dance-groups').flush([]);
expect(received).not.toHaveBeenCalled();
http.expectOne('/api/dance-schools/7/shows').flush([]);
http.expectOne('/api/dance-schools/7/coaches').flush([]);
const school = {
id: 7,
name: 'Studio',
revision: 0,
dancerIds: [],
danceGroupIds: [],
showIds: [],
};
http
.expectOne('/api/dance-schools/7/data')
.flush({ school, dancers: [], groups: [], shows: [], coaches: [] });
expect(received).toHaveBeenCalledWith({
school,
dancers: [],
@@ -34,12 +38,32 @@ describe('SchoolApi contract', () => {
});
});
it('sends the loaded school revision without retrying a stale mutation', () => {
api.schoolData(7).subscribe();
http
.expectOne('/api/dance-schools/7/data')
.flush({ school: { id: 7, revision: 4 }, dancers: [], groups: [], shows: [], coaches: [] });
const failure = vi.fn();
api.saveDancer(7, { name: 'Sam', birthDate: '2010-05-12' }).subscribe({ error: failure });
const request = http.expectOne('/api/dance-schools/7/dancers');
expect(request.request.headers.get('X-School-Revision')).toBe('4');
request.flush({ message: 'Herlaad de gegevens' }, { status: 409, statusText: 'Conflict' });
expect(failure).toHaveBeenCalledOnce();
});
it('updates an existing entity even when its id is zero', () => {
api.saveSchool({ name: 'Renamed' }, 0).subscribe();
const request = http.expectOne('/api/dance-schools/0');
expect(request.request.method).toBe('PUT');
expect(request.request.body).toEqual({ name: 'Renamed' });
request.flush({ id: 0, name: 'Renamed', dancerIds: [], danceGroupIds: [], showIds: [] });
request.flush({
id: 0,
name: 'Renamed',
revision: 0,
dancerIds: [],
danceGroupIds: [],
showIds: [],
});
});
it('keeps group details separate from memberships', () => {