mirror of
https://github.com/immich-app/immich.git
synced 2025-01-01 08:31:59 +00:00
fix(server): put system config (#9425)
This commit is contained in:
parent
06402aa9fb
commit
9c5a2b97bf
2 changed files with 21 additions and 1 deletions
|
@ -86,6 +86,26 @@ describe('/system-config', () => {
|
||||||
expect(body).toEqual(errorDto.unauthorized);
|
expect(body).toEqual(errorDto.unauthorized);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should always return the new config', async () => {
|
||||||
|
const config = await getSystemConfig(admin.accessToken);
|
||||||
|
|
||||||
|
const response1 = await request(app)
|
||||||
|
.put('/system-config')
|
||||||
|
.set('Authorization', `Bearer ${admin.accessToken}`)
|
||||||
|
.send({ ...config, newVersionCheck: { enabled: false } });
|
||||||
|
|
||||||
|
expect(response1.status).toBe(200);
|
||||||
|
expect(response1.body).toEqual({ ...config, newVersionCheck: { enabled: false } });
|
||||||
|
|
||||||
|
const response2 = await request(app)
|
||||||
|
.put('/system-config')
|
||||||
|
.set('Authorization', `Bearer ${admin.accessToken}`)
|
||||||
|
.send({ ...config, newVersionCheck: { enabled: true } });
|
||||||
|
|
||||||
|
expect(response2.status).toBe(200);
|
||||||
|
expect(response2.body).toEqual({ ...config, newVersionCheck: { enabled: true } });
|
||||||
|
});
|
||||||
|
|
||||||
it('should reject an invalid config entry', async () => {
|
it('should reject an invalid config entry', async () => {
|
||||||
const { status, body } = await request(app)
|
const { status, body } = await request(app)
|
||||||
.put('/system-config')
|
.put('/system-config')
|
||||||
|
|
|
@ -321,7 +321,7 @@ export class SystemConfigCore {
|
||||||
await this.repository.deleteKeys(deletes.map((item) => item.key));
|
await this.repository.deleteKeys(deletes.map((item) => item.key));
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = await this.getConfig();
|
const config = await this.getConfig(true);
|
||||||
|
|
||||||
this.config$.next(config);
|
this.config$.next(config);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue