fix: persist dedicated physique targeting settings
This commit is contained in:
1 parent
5c57ed337b
commit
8ea1cf16d4
3 files changed
+41
-2
No files matched your search
@@ -139,6 +139,33 @@ describe('config route physique targeting', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('does not let a stale advanced-config copy overwrite dedicated physique controls', async () => {
|
||||
const { app, config, saved } = harness();
|
||||
const current = await (await request(app, '/api/config')).json();
|
||||
|
||||
const response = await request(app, '/api/config', {
|
||||
method: 'PUT',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
reddit: {
|
||||
physiqueTargeting: { enabled: true, minScore: 1, maxScore: 6 },
|
||||
},
|
||||
advanced: {
|
||||
...current.advanced,
|
||||
reddit: {
|
||||
...current.advanced.reddit,
|
||||
physiqueTargeting: { enabled: false, minScore: 1, maxScore: 10 },
|
||||
},
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(config.reddit.physiqueTargeting).toEqual({ enabled: true, minScore: 1, maxScore: 6 });
|
||||
expect(saved.at(-1)?.reddit.physiqueTargeting).toEqual({ enabled: true, minScore: 1, maxScore: 6 });
|
||||
expect((await response.json()).advanced.reddit).not.toHaveProperty('physiqueTargeting');
|
||||
});
|
||||
|
||||
it('rejects an inverted physique range without mutating configuration', async () => {
|
||||
const { app, config, saved } = harness();
|
||||
|
||||
|
||||
Reference in new issue
Block a user