-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed unexpected behaviors around saving an engagement and polling fo… (
#285) * fixed unexpected behaviors around saving an engagement and polling for updates * removed environment class * removed useless comments
- Loading branch information
1 parent
f3ba194
commit cfb5790
Showing
3 changed files
with
45 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,9 @@ describe('Engagement Context', () => { | |
cleanup(); | ||
}); | ||
|
||
test('by default, engagements are undefined', () => { | ||
test('by default, engagements are an empty array', () => { | ||
const { result } = getHook(); | ||
expect(result.current.engagements).toEqual(undefined); | ||
expect(result.current.engagements).toEqual([]); | ||
}); | ||
|
||
test('Fetch Engagements', async () => { | ||
|
@@ -246,7 +246,11 @@ describe('Engagement Context', () => { | |
result.current.getEngagements(); | ||
await waitForNextUpdate(); | ||
}); | ||
expect(result.current.engagements[0]).toEqual(initialEngagement); | ||
await act(async () => { | ||
result.current.setCurrentEngagement(result.current.engagements[0]); | ||
await waitForNextUpdate(); | ||
}); | ||
expect(result.current.currentEngagement).toEqual(initialEngagement); | ||
let modifiedEngagement = { | ||
...initialEngagement, | ||
customer_contact_email: '[email protected]', | ||
|
@@ -255,7 +259,7 @@ describe('Engagement Context', () => { | |
result.current.saveEngagement(modifiedEngagement); | ||
await waitForNextUpdate(); | ||
}); | ||
expect(result.current.engagements[0]).toEqual(modifiedEngagement); | ||
expect(result.current.currentEngagement).toEqual(modifiedEngagement); | ||
}); | ||
test('saveEngagement reverts to the initial engagement when the save was unsuccessful', async () => { | ||
const initialEngagement = Engagement.fromFake(true); | ||
|
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