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

This commit is contained in:
2026-09-10 01:36:15 -04:00
parent ec322df25c
commit ffd239d27c
19 changed files with 364 additions and 0 deletions
+20
View File
@@ -151,4 +151,24 @@ test('updates admin settings through the CSRF-protected API', async () => {
} finally {
globalThis.fetch = originalFetch;
}
});
test('creates an admin saved view through the CSRF-protected API', async () => {
const originalFetch = globalThis.fetch;
globalThis.fetch = async (url, options) => {
assert.equal(url, '/api/v1/admin/saved-views');
assert.equal(options.method, 'POST');
assert.equal(options.headers['x-csrf-token'], 'csrf-token');
assert.deepEqual(JSON.parse(options.body), { name: 'Recent', filters: { sort: 'recent' } });
return { ok: true, async json() { return { data: { id: 'view-1', name: 'Recent', filters: { sort: 'recent' } } }; } };
};
try {
const { createAdminSavedView } = await import('../src/services/admin-saved-view-service.js');
assert.deepEqual(await createAdminSavedView({ name: 'Recent', filters: { sort: 'recent' } }, 'csrf-token'), {
id: 'view-1', name: 'Recent', filters: { sort: 'recent' },
});
} finally {
globalThis.fetch = originalFetch;
}
});