(cherry picked from commit 4978269156)
Co-authored-by: Daniel Espino García <larkox@gmail.com>
This commit is contained in:
parent
dc02a7b825
commit
6a86cccda0
2 changed files with 15 additions and 0 deletions
|
|
@ -120,6 +120,20 @@ describe('fetchPlaybookRunsForChannel', () => {
|
|||
expect(handlePlaybookRuns).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should update the channel in the ephemeral store when there are no runs', async () => {
|
||||
mockClient.fetchPlaybookRuns.mockResolvedValueOnce({
|
||||
items: [],
|
||||
has_more: false,
|
||||
});
|
||||
|
||||
const result = await fetchPlaybookRunsForChannel(serverUrl, channelId);
|
||||
expect(result).toBeDefined();
|
||||
expect(result.error).toBeUndefined();
|
||||
expect(result.runs).toEqual([]);
|
||||
expect(handlePlaybookRuns).not.toHaveBeenCalled();
|
||||
expect(EphemeralStore.getChannelPlaybooksSynced(serverUrl, channelId)).toBe(true);
|
||||
});
|
||||
|
||||
it('should update the channel in the ephemeral store', async () => {
|
||||
mockClient.fetchPlaybookRuns.mockResolvedValueOnce({
|
||||
items: [mockPlaybookRun],
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ export const fetchPlaybookRunsForChannel = async (serverUrl: string, channelId:
|
|||
}
|
||||
|
||||
if (!allRuns.length) {
|
||||
EphemeralStore.setChannelPlaybooksSynced(serverUrl, channelId);
|
||||
return {runs: []};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue