Skip to content

Commit

Permalink
feat(Surveys): Activate surveys based on actions (#1295)
Browse files Browse the repository at this point in the history
This commit allows us to activate surveys if any actions they're configured with are performed in the browser.
  • Loading branch information
Phanatic authored Jul 10, 2024
1 parent 46ed238 commit ec00d33
Show file tree
Hide file tree
Showing 5 changed files with 443 additions and 189 deletions.
18 changes: 6 additions & 12 deletions src/__tests__/surveys.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,12 @@ describe('surveys', () => {
expect(data).toEqual(surveysWithEvents)
}, true)

const registry = surveys._surveyEventReceiver?.getEventRegistry()
expect(registry.has('second-survey')).toBeFalsy()
expect(registry.has('first-survey')).toBeTruthy()
expect(registry.get('first-survey')).toEqual([
'user_subscribed',
'user_unsubscribed',
'billing_changed',
'billing_removed',
])

expect(registry.has('third-survey')).toBeTruthy()
expect(registry.get('third-survey')).toEqual(['user_subscribed', 'user_unsubscribed', 'address_changed'])
const registry = surveys._surveyEventReceiver?.getEventToSurveys()
expect(registry.has('user_subscribed')).toBeTruthy()
expect(registry.get('user_subscribed')).toEqual(['first-survey', 'third-survey'])

expect(registry.has('address_changed')).toBeTruthy()
expect(registry.get('address_changed')).toEqual(['third-survey'])
})

it('getSurveys force reloads when called with true', () => {
Expand Down
Loading

0 comments on commit ec00d33

Please sign in to comment.