Show all client metadata filter options
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 44s

This commit is contained in:
Cauê Faleiros
2026-06-23 15:06:41 -03:00
parent 06faadab5f
commit b7a2059070
2 changed files with 13 additions and 19 deletions

View File

@@ -612,7 +612,7 @@ test('getClientAnalytics groups phone-less history through the customer identity
}
});
test('getClientFilterOptions returns distinct date-scoped order metadata options', async () => {
test('getClientFilterOptions returns all distinct order metadata options', async () => {
const originalQuery = pool.query;
const calls = [];
@@ -641,10 +641,12 @@ test('getClientFilterOptions returns distinct date-scoped order metadata options
assert.equal(calls.length, 3);
calls.forEach(call => {
assert.deepEqual(call.params, ['2026-06-01', '2026-06-15']);
assert.match(call.sql, /data_pedido_date >= \$1::date/);
assert.match(call.sql, /data_pedido_date <= \$2::date/);
assert.deepEqual(call.params, []);
assert.doesNotMatch(call.sql, /data_pedido_date >=/);
assert.doesNotMatch(call.sql, /data_pedido_date <=/);
});
assert.match(calls[0].sql, /WHERE NULLIF\(TRIM\(marketplace\), ''\) IS NOT NULL/);
assert.match(calls[2].sql, /NULLIF\(TRIM\(nome_vendedor\), ''\) IS NOT NULL/);
assert.deepEqual(options.marketplaces, ['Mercado Livre', 'Shopee']);
assert.deepEqual(options.salesChannels, ['Online']);
assert.deepEqual(options.sellers, [