|
| 1 | +/* |
| 2 | + * Copyright (C) NIWA & British Crown (Met Office) & Contributors. |
| 3 | + * |
| 4 | + * This program is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | +import { RE } from '@/components/graphqlFormGenerator/components/vuetify' |
| 18 | + |
| 19 | +describe('RE', () => { |
| 20 | + describe('cyclePoint', () => { |
| 21 | + const regex = new RegExp(String.raw`^${RE.cyclePoint}$`) |
| 22 | + it.for([ |
| 23 | + // Integer |
| 24 | + '1', |
| 25 | + '105', |
| 26 | + '999999999', |
| 27 | + // Calendar date |
| 28 | + '2025', |
| 29 | + '20250619', |
| 30 | + '20250619T15', |
| 31 | + '20250619T153045', |
| 32 | + '20250619T153045Z', |
| 33 | + '20250619T153045+01', |
| 34 | + '20250619T153045-0500', |
| 35 | + '2025-06-19', |
| 36 | + '2025-06-19T15', |
| 37 | + '2025-06-19T15Z', |
| 38 | + '2025-06-19T15:30:45', |
| 39 | + '2025-06-19T15:30:45Z', |
| 40 | + '2025-06-19T15:30:45+01', |
| 41 | + '2025-06-19T15:30:45-05:00', |
| 42 | + // Week date |
| 43 | + '2015W534', |
| 44 | + '2015W534T0631', |
| 45 | + '2015-W53-4', |
| 46 | + '2015-W53-4T06:31', |
| 47 | + '2015W534T0631+02', |
| 48 | + '2015-W53-4T06:31+02', |
| 49 | + // Ordinal date |
| 50 | + '2025170', |
| 51 | + '2025-170', |
| 52 | + '2025170T15:30', |
| 53 | + '2025-170T15:30:45+00:00', |
| 54 | + ])('matches %s', (str) => { |
| 55 | + expect(regex.test(str)).toBe(true) |
| 56 | + }) |
| 57 | + }) |
| 58 | +}) |
0 commit comments