import { universalDate } from './index' describe('formatting - universalDate', () => { const daylightSavingDateTime = '2021-02-28T00:00:00.000Z' // UTC const standardDateTime = '2021-07-31T00:00:00.000Z' // UTC it.each([ ['America/Phoenix', 'en-US', '27/2/2021'], ['America/Chicago', 'en-US', '27/2/2021'], ['America/New_York', 'en-US', '27/2/2021'], ['America/Montevideo', 'es-UY', '27/2/2021'], ['America/Sao_Paulo', 'pt-BR', '27/2/2021'], ['UTC', 'en-US', '28/2/2021'], ['UTC', 'en-GB', '28/2/2021'], ['Europe/London', 'en-GB', '28/2/2021'], ['Europe/Paris', 'fr-FR', '28/2/2021'], ['Asia/Tbilisi', 'ka-GE', '28/2/2021'], ['Asia/Kolkata', 'hi-IN', '28/2/2021'], ])( 'daylightSavingDateTime - returns a string formatted for the TZ and Locale (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect( universalDate(daylightSavingDateTime, { timezone, locale }) ).toEqual(localisedResult) ) it.each([ ['America/Phoenix', 'en-US', '30/7/2021'], ['America/Chicago', 'en-US', '30/7/2021'], ['America/New_York', 'en-US', '30/7/2021'], ['America/Montevideo', 'es-UY', '30/7/2021'], ['America/Sao_Paulo', 'pt-BR', '30/7/2021'], ['UTC', 'en-US', '31/7/2021'], ['UTC', 'en-GB', '31/7/2021'], ['Europe/London', 'en-GB', '31/7/2021'], ['Europe/Paris', 'fr-FR', '31/7/2021'], ['Asia/Tbilisi', 'ka-GE', '31/7/2021'], ['Asia/Kolkata', 'hi-IN', '31/7/2021'], ])( 'standardDateTime - returns a string formatted for the TZ and Locale (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect(universalDate(standardDateTime, { timezone, locale })).toEqual( localisedResult ) ) })