Skip to content

Commit

Permalink
fix: smartly test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
koladilip committed Aug 20, 2024
1 parent c0cb321 commit ecab59f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cdk/v2/destinations/smartly/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ const batchBuilder = (batch, destination) => ({
* @returns
*/
const batchResponseBuilder = (events) => {
if (events.length === 0) {
return [];

Check warning on line 111 in src/cdk/v2/destinations/smartly/utils.js

View check run for this annotation

Codecov / codecov/patch

src/cdk/v2/destinations/smartly/utils.js#L111

Added line #L111 was not covered by tests
}
const { destination } = events[0];
const batches = BatchUtils.chunkArrayBySizeAndLength(events, { maxItems: config.MAX_BATCH_SIZE });

const response = [];
batches.items.forEach((batch) => {
const batchedResponse = batchBuilder(batch, destination);
Expand Down
1 change: 1 addition & 0 deletions test/integrations/destinations/smartly/mocks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import config from '../../../../src/cdk/v2/destinations/smartly/config';

export const defaultMockFns = () => {
jest.useFakeTimers().setSystemTime(new Date('2024-02-01'));
jest.replaceProperty(config, 'MAX_BATCH_SIZE', 2);
};
3 changes: 3 additions & 0 deletions test/integrations/destinations/smartly/router/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ export const data = [
},
},
},
mockFns: () => {
jest.useFakeTimers().setSystemTime(new Date('2024-02-01'));
},
},
{
name: 'smartly',
Expand Down

0 comments on commit ecab59f

Please sign in to comment.