Skip to content

Commit a30488d

Browse files
committed
fix: update test
1 parent 80cb8e4 commit a30488d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • packages/analytics-js-integrations/__tests__/integrations/Braze

packages/analytics-js-integrations/__tests__/integrations/Braze/browser.test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,10 +1231,13 @@ describe('track - recommended ecommerce events', () => {
12311231

12321232
it('does not emit an empty product object when cart_updated has no product fields', () => {
12331233
const braze = buildBraze();
1234-
trackEvent(braze, 'Cart Updated', { cart_id: 'c1' });
1234+
// `Product Added` maps to ecommerce.cart_updated; with no product fields the
1235+
// single-product wrap must not emit a degenerate `[{}]`.
1236+
trackEvent(braze, 'Product Added', { cart_id: 'c1' });
12351237

1238+
const [eventName, props] = window.braze.logCustomEvent.mock.calls[0];
1239+
expect(eventName).toBe('ecommerce.cart_updated');
12361240
// no degenerate `[{}]` — the empty products array is scrubbed off entirely
1237-
const props = window.braze.logCustomEvent.mock.calls[0][1];
12381241
expect(props.products).toBeUndefined();
12391242
});
12401243

0 commit comments

Comments
 (0)