-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add a callback when Chartjs is loaded * Put flushPromise as a utils method and refactor * Test reactivity manager
- Loading branch information
Showing
6 changed files
with
64 additions
and
11 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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import ReactivityManager from 'c/reactivityManager'; | ||
|
||
describe('Reactivity Manager: ', () => { | ||
const throttledFn = jest.fn(); | ||
const rm = new ReactivityManager(); | ||
rm.registerJob(throttledFn); | ||
let reactivityProxy; | ||
|
||
test('get reactivity Proxy', () => { | ||
reactivityProxy = rm.getReactivityProxy(); | ||
expect(reactivityProxy).toEqual({}); | ||
expect(throttledFn).not.toBeCalled(); | ||
}); | ||
|
||
test('proxy trigger throttling of the registered job', async () => { | ||
reactivityProxy.test = 'test'; | ||
expect(throttledFn).not.toBeCalled(); | ||
await flushPromises().then(() => { | ||
expect(throttledFn).toBeCalled(); | ||
}); | ||
}); | ||
test('manual call trigger throttling', async () => { | ||
rm.throttleRegisteredJob(); | ||
expect(throttledFn).not.toBeCalled(); | ||
await flushPromises().then(() => { | ||
expect(throttledFn).toBeCalled(); | ||
}); | ||
}); | ||
}); |
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