This commit is contained in:
@@ -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 />');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user