import { dayOfWeek } from './index' describe('formatting - dayOfWeek', () => { const daylightSavingDateTime = '2021-02-28T00:00:00.000Z' // UTC, Sunday const standardDateTime = '2021-07-31T00:00:00.000Z' // UTC, Saturday const long = false const short = true it.each([ ['America/Phoenix', 'en-US', 'Saturday'], ['America/Chicago', 'en-US', 'Saturday'], ['America/New_York', 'en-US', 'Saturday'], ['America/Montevideo', 'es-UY', 'sábado'], ['America/Sao_Paulo', 'pt-BR', 'sábado'], ['UTC', 'en-US', 'Sunday'], ['UTC', 'en-GB', 'Sunday'], ['Europe/London', 'en-GB', 'Sunday'], ['Europe/Paris', 'fr-FR', 'dimanche'], ['Asia/Tbilisi', 'ka-GE', 'კვირა'], ['Asia/Kolkata', 'hi-IN', 'रविवार'], ])( 'daylightSavingDateTime - returns correct day of week, long (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect( dayOfWeek(daylightSavingDateTime, long, { timezone, locale }) ).toEqual(localisedResult) ) it.each([ ['America/Phoenix', 'en-US', 'Friday'], ['America/Chicago', 'en-US', 'Friday'], ['America/New_York', 'en-US', 'Friday'], ['America/Montevideo', 'es-UY', 'viernes'], ['America/Sao_Paulo', 'pt-BR', 'sexta-feira'], ['UTC', 'en-US', 'Saturday'], ['UTC', 'en-GB', 'Saturday'], ['Europe/London', 'en-GB', 'Saturday'], ['Europe/Paris', 'fr-FR', 'samedi'], ['Asia/Tbilisi', 'ka-GE', 'შაბათი'], ['Asia/Kolkata', 'hi-IN', 'शनिवार'], ])( 'standardDateTime - returns correct day of week, long (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect(dayOfWeek(standardDateTime, long, { timezone, locale })).toEqual( localisedResult ) ) it.each([ ['America/Phoenix', 'en-US', 'Sat'], ['America/Chicago', 'en-US', 'Sat'], ['America/New_York', 'en-US', 'Sat'], ['America/Montevideo', 'es-UY', 'sáb'], ['America/Sao_Paulo', 'pt-BR', 'sáb.'], ['UTC', 'en-US', 'Sun'], ['UTC', 'en-GB', 'Sun'], ['Europe/London', 'en-GB', 'Sun'], ['Europe/Paris', 'fr-FR', 'dim.'], ['Asia/Tbilisi', 'ka-GE', 'კვი'], ['Asia/Kolkata', 'hi-IN', 'रवि'], ])( 'daylightSavingDateTime - returns correct day of week, short (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect( dayOfWeek(daylightSavingDateTime, short, { timezone, locale }) ).toEqual(localisedResult) ) it.each([ ['America/Phoenix', 'en-US', 'Fri'], ['America/Chicago', 'en-US', 'Fri'], ['America/New_York', 'en-US', 'Fri'], ['America/Montevideo', 'es-UY', 'vie'], ['America/Sao_Paulo', 'pt-BR', 'sex.'], ['UTC', 'en-US', 'Sat'], ['UTC', 'en-GB', 'Sat'], ['Europe/London', 'en-GB', 'Sat'], ['Europe/Paris', 'fr-FR', 'sam.'], ['Asia/Tbilisi', 'ka-GE', 'შაბ'], ['Asia/Kolkata', 'hi-IN', 'शनि'], ])( 'standardDateTime - returns correct day of week, short (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect(dayOfWeek(standardDateTime, short, { timezone, locale })).toEqual( localisedResult ) ) })