Skip to content

Commit

Permalink
Support custom amplitude instance (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttmarek committed Nov 21, 2017
1 parent 436bd54 commit 6058769
Show file tree
Hide file tree
Showing 4 changed files with 251 additions and 193 deletions.
16 changes: 16 additions & 0 deletions src/targets/amplitude/__tests__/amplitude.mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const instanceMock = {
identify: jest.fn(),
logRevenueV2: jest.fn(),
};

const identityMock = {
add: jest.fn(),
set: jest.fn(),
Expand All @@ -33,4 +34,19 @@ const amplitudeSDKMock = {
logRevenueV2: jest.fn(),
};

export function resetAllMocks() {
[
instanceMock,
identityMock,
revenueMock,
amplitudeSDKMock,
].forEach(mockObj => {
Object.keys(mockObj).forEach(key => {
if (typeof mockObj[key].mockReset === 'function') {
mockObj[key].mockReset();
}
});
});
}

export default amplitudeSDKMock;
Loading

0 comments on commit 6058769

Please sign in to comment.