Refine seller dashboard chart
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m24s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m24s
This commit is contained in:
@@ -153,6 +153,12 @@ test('getDashboardAnalytics includes seller revenue and order metrics', async ()
|
||||
};
|
||||
}
|
||||
|
||||
if (sql.includes('data_pedido_date::text as date')) {
|
||||
return {
|
||||
rows: [{ id: '977226210', name: 'KEDMA DA SILVA', date: '2026-06-05', value: 400, orders: 2 }]
|
||||
};
|
||||
}
|
||||
|
||||
if (sql.includes('seller_orders') && sql.includes('SUM(quantidade * valor_unitario)')) {
|
||||
return {
|
||||
rows: [{ id: '977226210', name: 'KEDMA DA SILVA', value: 750 }]
|
||||
@@ -181,7 +187,7 @@ test('getDashboardAnalytics includes seller revenue and order metrics', async ()
|
||||
const sellerRevenueQuery = calls.find(call => call.sql.includes('seller_orders') && call.sql.includes('SUM(quantidade * valor_unitario)'));
|
||||
const sellerOrdersQuery = calls.find(call => call.sql.includes('seller_orders') && call.sql.includes('COUNT(DISTINCT'));
|
||||
|
||||
assert.equal(calls.length, 5);
|
||||
assert.equal(calls.length, 6);
|
||||
calls.forEach(call => {
|
||||
assert.deepEqual(call.params, ['2026-06-01', '2026-06-24']);
|
||||
});
|
||||
@@ -194,6 +200,9 @@ test('getDashboardAnalytics includes seller revenue and order metrics', async ()
|
||||
assert.deepEqual(dashboard.ordersBySeller, [
|
||||
{ id: '977226210', name: 'KEDMA DA SILVA', value: 3 }
|
||||
]);
|
||||
assert.deepEqual(dashboard.sellerRevenueByDate, [
|
||||
{ id: '977226210', name: 'KEDMA DA SILVA', date: '2026-06-05', value: 400, orders: 2 }
|
||||
]);
|
||||
} finally {
|
||||
pool.query = originalQuery;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user