]> source.dussan.org Git - sonarqube.git/commitdiff
[NO-JIRA] fix DateTimeFormatter to accept different locales
authorKevin Silva <kevin.silva@sonarsource.com>
Tue, 21 Feb 2023 11:01:13 +0000 (12:01 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 21 Feb 2023 12:02:56 +0000 (12:02 +0000)
server/sonar-web/src/main/js/components/intl/__tests__/DateTimeFormatter-test.tsx

index 7caddd1f23e4a01f26b3517e0a505e4f156b3bff..aebe6b1a3a465bb7e4ef436f96f7fb790015f25c 100644 (file)
@@ -24,10 +24,10 @@ import DateTimeFormatter from '../DateTimeFormatter';
 
 it('should render correctly', () => {
   renderDateTimeFormatter();
-  expect(screen.getByText('February 20, 2020, 8:20 PM')).toBeInTheDocument();
+  expect(screen.getByText(/February 20, 2020(\sat|,) 8:20 PM/)).toBeInTheDocument();
 
   renderDateTimeFormatter((formatted: string) => <span>Nice date: {formatted}</span>);
-  expect(screen.getByText('Nice date: February 20, 2020, 8:20 PM')).toBeInTheDocument();
+  expect(screen.getByText(/Nice date: February 20, 2020(\sat|,) 8:20 PM/)).toBeInTheDocument();
 });
 
 function renderDateTimeFormatter(children?: (d: string) => React.ReactNode) {