feat(api): set person color (#15937)

This commit is contained in:
Jason Rasmussen 2025-02-07 10:06:58 -05:00 committed by GitHub
parent 2e5007adef
commit 23014c263b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 182 additions and 21 deletions

View file

@ -195,6 +195,7 @@ describe('/people', () => {
.send({
name: 'New Person',
birthDate: '1990-01-01',
color: '#333',
});
expect(status).toBe(201);
expect(body).toMatchObject({
@ -273,6 +274,24 @@ describe('/people', () => {
expect(body).toMatchObject({ birthDate: null });
});
it('should set a color', async () => {
const { status, body } = await request(app)
.put(`/people/${visiblePerson.id}`)
.set('Authorization', `Bearer ${admin.accessToken}`)
.send({ color: '#555' });
expect(status).toBe(200);
expect(body).toMatchObject({ color: '#555' });
});
it('should clear a color', async () => {
const { status, body } = await request(app)
.put(`/people/${visiblePerson.id}`)
.set('Authorization', `Bearer ${admin.accessToken}`)
.send({ color: null });
expect(status).toBe(200);
expect(body.color).toBeUndefined();
});
it('should mark a person as favorite', async () => {
const person = await utils.createPerson(admin.accessToken, {
name: 'visible_person',