-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(insights): Fix ApiRequest.subscription() (#25762)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
a42c2ae
commit 1b57c13
Showing
3 changed files
with
27 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,12 +26,11 @@ export const fixtureSubscriptionResponse = (id: number, args: Partial<Subscripti | |
describe('subscriptionLogic', () => { | ||
let newLogic: ReturnType<typeof subscriptionLogic.build> | ||
let existingLogic: ReturnType<typeof subscriptionLogic.build> | ||
let subscriptions: SubscriptionType[] = [] | ||
beforeEach(async () => { | ||
subscriptions = [fixtureSubscriptionResponse(1), fixtureSubscriptionResponse(2)] | ||
useMocks({ | ||
get: { | ||
'/api/projects/:team/subscriptions/1': fixtureSubscriptionResponse(1), | ||
'/api/environments/:team/subscriptions': { count: 1, results: [fixtureSubscriptionResponse(1)] }, | ||
'/api/environments/:team/subscriptions/1': fixtureSubscriptionResponse(1), | ||
'/api/projects/:team/integrations': { count: 0, results: [] }, | ||
}, | ||
}) | ||
|
@@ -42,12 +41,28 @@ describe('subscriptionLogic', () => { | |
}) | ||
existingLogic = subscriptionLogic({ | ||
insightShortId: Insight1, | ||
id: subscriptions[0].id, | ||
id: 1, | ||
}) | ||
newLogic.mount() | ||
existingLogic.mount() | ||
}) | ||
|
||
it('loads existing subscription', async () => { | ||
router.actions.push('/insights/123/subscriptions/1') | ||
await expectLogic(existingLogic).toFinishListeners().toDispatchActions(['loadSubscriptionSuccess']) | ||
expect(existingLogic.values.subscription).toMatchObject({ | ||
id: 1, | ||
title: 'My example subscription', | ||
target_type: 'email', | ||
target_value: '[email protected],[email protected]', | ||
frequency: 'monthly', | ||
interval: 2, | ||
start_date: '2022-01-01T00:09:00', | ||
byweekday: ['wednesday'], | ||
bysetpos: 1, | ||
}) | ||
}) | ||
|
||
it('updates values depending on frequency', async () => { | ||
router.actions.push('/insights/123/subscriptions/new') | ||
await expectLogic(newLogic).toFinishListeners() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters