(t: TFunction)
| 2 | import { TFunction } from 'i18next'; |
| 3 | |
| 4 | export const configValidationSchema = (t: TFunction) => |
| 5 | yup.string().test('should have correct format', t('configFormat', { ns: 'validation' }), (value) => { |
| 6 | if (value == null || value === '') { |
| 7 | return true; |
| 8 | } |
| 9 | |
| 10 | const lines = value |
| 11 | .split(/\r?\n/) |
| 12 | .map((line) => line.trim()) |
| 13 | .filter(Boolean); |
| 14 | |
| 15 | return lines.length > 0 && lines.every((line) => /^[^:=\n\r]+[:=][^\n\r]+$/i.test(line)); |
| 16 | }); |
no outgoing calls
no test coverage detected