Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): put system config #9425

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions e2e/src/api/specs/system-config.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,26 @@ describe('/system-config', () => {
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 () => {
const { status, body } = await request(app)
.put('/system-config')
Expand Down
2 changes: 1 addition & 1 deletion server/src/cores/system-config.core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export class SystemConfigCore {
await this.repository.deleteKeys(deletes.map((item) => item.key));
}

const config = await this.getConfig();
const config = await this.getConfig(true);

this.config$.next(config);

Expand Down
Loading