feat: add seller settings
Quality / test (push) Canceled after 0s

This commit is contained in:
2026-09-10 01:14:57 -04:00
parent 24f51212e5
commit cf61ec3c2c
20 changed files with 401 additions and 2 deletions
+20
View File
@@ -116,4 +116,24 @@ test('updates selected admin inventory tags through the bulk API', async () => {
} finally {
globalThis.fetch = originalFetch;
}
});
test('updates admin settings through the CSRF-protected API', async () => {
const originalFetch = globalThis.fetch;
globalThis.fetch = async (url, options) => {
assert.equal(url, '/api/v1/admin/settings');
assert.equal(options.method, 'PATCH');
assert.equal(options.headers['x-csrf-token'], 'csrf-token');
assert.deepEqual(JSON.parse(options.body), { pricing: { defaultStrategy: 'median' } });
return { ok: true, async json() { return { data: { pricing: { defaultStrategy: 'median' } } }; } };
};
try {
const { updateAdminSettings } = await import('../src/services/admin-settings-service.js');
assert.deepEqual(await updateAdminSettings({ pricing: { defaultStrategy: 'median' } }, 'csrf-token'), {
pricing: { defaultStrategy: 'median' },
});
} finally {
globalThis.fetch = originalFetch;
}
});