diff --git a/public/app/features/alerting/unified/components/rules/RulesGroup.test.tsx b/public/app/features/alerting/unified/components/rules/RulesGroup.test.tsx index fca35aa7dc4..a2f82b60442 100644 --- a/public/app/features/alerting/unified/components/rules/RulesGroup.test.tsx +++ b/public/app/features/alerting/unified/components/rules/RulesGroup.test.tsx @@ -177,4 +177,32 @@ describe('Rules group tests', () => { expect(ui.editGroupButton.query()).not.toBeInTheDocument(); }); }); + + describe('Ungrouped rules', () => { + const ungroupedGroup: CombinedRuleGroup = { + name: 'no_group_for_rule_TestRule', + rules: [ + mockCombinedRule({ + name: 'TestRule', + rulerRule: mockGrafanaRulerRule({ namespace_uid: 'folder-123' }), + }), + ], + totals: {}, + }; + + const namespace: CombinedRuleNamespace = { + name: 'TestNamespace', + rulesSource: 'grafana', + groups: [ungroupedGroup], + }; + + beforeEach(() => { + mockUseHasRuler(true, GRAFANA_RULER_CONFIG); + }); + + it('Should display rule name with (Ungrouped) suffix in grouped view', async () => { + renderRulesGroup(namespace, ungroupedGroup); + expect(await screen.findByText(/TestRule \(Ungrouped\)/)).toBeInTheDocument(); + }); + }); });