@@ -177,4 +177,41 @@ def assert_display_name_text(organisation, expected_text)
177177 description = organisation_display_name_including_parental_and_child_relationships ( org )
178178 assert_equal "TO works with the Department of Testing and is supported by 2 agencies and public bodies." , strip_html_tags ( description )
179179 end
180+
181+ test "non-ministerial department renders Welsh identification sentence" do
182+ org = create ( :organisation , acronym : "CC" , name : "Comisiwn Elusennau" , organisation_type : OrganisationType . non_ministerial_department )
183+
184+ I18n . with_locale ( :cy ) do
185+ assert_display_name_text org , "Adran anweinidogol yw'r CC."
186+ end
187+ end
188+
189+ test "non-ministerial department with parents renders Welsh identification sentence" do
190+ parent = create ( :ministerial_department , name : "Department of Testing" )
191+ org = create ( :organisation , acronym : "CC" , name : "Comisiwn Elusennau" , organisation_type : OrganisationType . non_ministerial_department , parent_organisations : [ parent ] )
192+
193+ I18n . with_locale ( :cy ) do
194+ assert_display_name_text org , "Adran anweinidogol yw'r CC."
195+ end
196+ end
197+
198+ test "non-ministerial department with supporting bodies renders mixed Welsh/English sentence in Welsh" do
199+ child = create ( :organisation , acronym : "CO" , name : "Child Organisation One" )
200+ org = create ( :organisation , acronym : "CC" , name : "Comisiwn Elusennau" , organisation_type : OrganisationType . non_ministerial_department )
201+ org . stubs ( :supporting_bodies ) . returns ( [ child ] )
202+
203+ I18n . with_locale ( :cy ) do
204+ description = organisation_display_name_including_parental_and_child_relationships ( org )
205+ assert_equal "Adran anweinidogol yw'r CC, supported by 1 public body." , strip_html_tags ( description )
206+ end
207+ end
208+
209+ test "non-Welsh-translated type falls back to English in Welsh locale" do
210+ parent = create ( :ministerial_department , name : "Department of Testing" )
211+ org = create ( :organisation , acronym : "EA" , name : "Executive Agency Example" , organisation_type : OrganisationType . executive_agency , parent_organisations : [ parent ] )
212+
213+ I18n . with_locale ( :cy ) do
214+ assert_display_name_text org , "EA is an executive agency, sponsored by the Department of Testing."
215+ end
216+ end
180217end
0 commit comments