Skip to content

Commit 35dc7f8

Browse files
committed
Add another missed test lol
1 parent 1afed28 commit 35dc7f8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/pages/OwnerPage/OnboardingOrg/OnboardingOrg.test.tsx

+22
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import userEvent from '@testing-library/user-event'
44
import { MemoryRouter, Route } from 'react-router-dom'
55
import { type Mock, vi } from 'vitest'
66

7+
import { eventTracker } from 'services/events/events'
78
import { useLocationParams } from 'services/navigation'
89

910
import OnboardingOrg from './OnboardingOrg'
@@ -18,6 +19,7 @@ vi.mock('services/navigation', async () => {
1819
useLocationParams: vi.fn(),
1920
}
2021
})
22+
vi.mock('services/events/events')
2123

2224
const mockedUseLocationParams = useLocationParams as Mock
2325

@@ -79,4 +81,24 @@ describe('OnboardingOrg', () => {
7981
// Modal should be closed
8082
expect(screen.queryByRole('dialog')).not.toBeInTheDocument()
8183
})
84+
85+
it('emits an event on clicking Install Codecov', async () => {
86+
const user = userEvent.setup()
87+
render(<OnboardingOrg />, { wrapper })
88+
89+
// Modal should be closed initially
90+
expect(screen.queryByRole('dialog')).not.toBeInTheDocument()
91+
92+
// Click install button to open the modal
93+
const installButton = screen.getByText('Install Codecov')
94+
await user.click(installButton)
95+
96+
expect(eventTracker().track).toHaveBeenCalledWith({
97+
type: 'Button Clicked',
98+
properties: {
99+
buttonName: 'Open App Install Modal',
100+
buttonLocation: 'Onboarding Container',
101+
},
102+
})
103+
})
82104
})

0 commit comments

Comments
 (0)