| 
									
										
										
										
											2022-03-14 22:57:01 +01:00
										 |  |  | import { describe } from "mocha" | 
					
						
							|  |  |  | import ValidatedTextField from "../../UI/Input/ValidatedTextField" | 
					
						
							| 
									
										
										
										
											2022-06-20 01:55:29 +02:00
										 |  |  | import { fail } from "assert" | 
					
						
							| 
									
										
										
										
											2022-06-20 03:14:44 +02:00
										 |  |  | import Translations from "../../UI/i18n/Translations" | 
					
						
							| 
									
										
										
										
											2022-03-14 22:57:01 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | describe("ValidatedTextFields", () => { | 
					
						
							| 
									
										
										
										
											2022-06-20 01:58:20 +02:00
										 |  |  |     it("should all have description in the translations", () => { | 
					
						
							|  |  |  |         const ts = Translations.t.validation | 
					
						
							|  |  |  |         const missingTranslations = Array.from(ValidatedTextField.allTypes.keys()) | 
					
						
							|  |  |  |             .filter((key) => ts[key] === undefined || ts[key].description === undefined) | 
					
						
							| 
									
										
										
										
											2022-06-20 03:14:44 +02:00
										 |  |  |             .filter((key) => key !== "distance") | 
					
						
							|  |  |  |         if (missingTranslations.length > 0) { | 
					
						
							|  |  |  |             fail( | 
					
						
							|  |  |  |                 "The validated text fields don't have a description defined in en.json for " + | 
					
						
							|  |  |  |                     missingTranslations.join(", ") + | 
					
						
							|  |  |  |                     ". (Did you just add one? Run `npm run generate:translations`)" | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |             ) | 
					
						
							| 
									
										
										
										
											2022-06-20 01:58:20 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |     }) | 
					
						
							| 
									
										
										
										
											2022-03-14 22:57:01 +01:00
										 |  |  | }) |