feat: add admin inventory Excel export
Quality / test (push) Canceled after 0s

This commit is contained in:
2026-09-10 01:11:07 -04:00
parent d6b4dbec5f
commit 24f51212e5
8 changed files with 91 additions and 0 deletions
@@ -80,3 +80,23 @@ test('downloads seller-scoped inventory CSV for an authenticated admin', async (
assert.equal(response.headers['content-disposition'], 'attachment; filename="inventory.csv"');
assert.equal(response.body, 'id,status\r\n"item-1","ACTIVE"');
});
test('downloads seller-scoped inventory Excel XML for an authenticated admin', async (testContext) => {
const app = buildApp({
authenticateAdmin: async () => ({ sellerId: 'seller-1' }),
adminExportService: {
async inventoryExcel({ sellerId }) {
assert.equal(sellerId, 'seller-1');
return '<?xml version="1.0"?><Workbook />';
},
},
});
testContext.after(() => app.close());
const response = await app.inject({ method: 'GET', url: '/api/v1/admin/exports/inventory.xls' });
assert.equal(response.statusCode, 200);
assert.equal(response.headers['content-type'], 'application/vnd.ms-excel; charset=utf-8');
assert.equal(response.headers['content-disposition'], 'attachment; filename="inventory.xls"');
assert.equal(response.body, '<?xml version="1.0"?><Workbook />');
});