diff --git a/static/app/stores/groupStore.spec.tsx b/static/app/stores/groupStore.spec.tsx index 74615ea4651050..bdebc318c808f6 100644 --- a/static/app/stores/groupStore.spec.tsx +++ b/static/app/stores/groupStore.spec.tsx @@ -3,6 +3,7 @@ import {GroupFixture} from 'sentry-fixture/group'; import {ProjectFixture} from 'sentry-fixture/project'; import GroupStore from 'sentry/stores/groupStore'; +import IndicatorStore from 'sentry/stores/indicatorStore'; import type {TimeseriesValue} from 'sentry/types/core'; import type {Group, GroupStats} from 'sentry/types/group'; import {GroupActivityType} from 'sentry/types/group'; @@ -228,6 +229,35 @@ describe('GroupStore', () => { expect(GroupStore.trigger).toHaveBeenCalledTimes(1); expect(GroupStore.trigger).toHaveBeenCalledWith(new Set(['1', '2', '3'])); }); + + it('should show generic message when itemIds is undefined', () => { + const addMessageSpy = jest.spyOn(IndicatorStore, 'addMessage'); + GroupStore.onDeleteSuccess('1337', undefined, {}); + + expect(addMessageSpy).toHaveBeenCalledWith('Deleted selected issues', 'success', { + duration: 4000, + }); + }); + + it('should show specific count when itemIds is provided', () => { + const addMessageSpy = jest.spyOn(IndicatorStore, 'addMessage'); + GroupStore.onDeleteSuccess('1337', ['1', '2'], {}); + + expect(addMessageSpy).toHaveBeenCalledWith('Deleted 2 Issues', 'success', { + duration: 4000, + }); + }); + + it('should show shortId for single issue deletion', () => { + const addMessageSpy = jest.spyOn(IndicatorStore, 'addMessage'); + const mockGroup = g('1', {shortId: 'ABC-123'}); + jest.spyOn(GroupStore, 'get').mockReturnValue(mockGroup); + GroupStore.onDeleteSuccess('1337', ['1'], {}); + + expect(addMessageSpy).toHaveBeenCalledWith('Deleted ABC-123', 'success', { + duration: 4000, + }); + }); }); describe('onAssignToSuccess()', () => { diff --git a/static/app/stores/groupStore.tsx b/static/app/stores/groupStore.tsx index 5350b3f581215d..bbfc1f4ab9cbc1 100644 --- a/static/app/stores/groupStore.tsx +++ b/static/app/stores/groupStore.tsx @@ -365,7 +365,9 @@ const storeConfig: GroupStoreDefinition = { onDeleteSuccess(_changeId, itemIds, _response) { const ids = this.itemIdsOrAll(itemIds); - if (ids.length > 1) { + if (itemIds === undefined) { + showAlert(t('Deleted selected issues'), 'success'); + } else if (ids.length > 1) { showAlert(t('Deleted %d Issues', ids.length), 'success'); } else { const shortId = ids.map(item => GroupStore.get(item)?.shortId).join('');