Fix playbooks not getting updated by websocket (#9088)

This commit is contained in:
Daniel Espino García 2025-08-26 14:01:04 +02:00 committed by GitHub
parent 4dd88ee6b6
commit 4978269156
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View file

@ -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],

View file

@ -45,6 +45,7 @@ export const fetchPlaybookRunsForChannel = async (serverUrl: string, channelId:
}
if (!allRuns.length) {
EphemeralStore.setChannelPlaybooksSynced(serverUrl, channelId);
return {runs: []};
}