@@ -320,7 +320,7 @@ describe('Class: PowertoolsLogFormatter', () => {
320
320
test ( 'it formats the timestamp to ISO 8601, accounting for the `America/New_York` timezone offset' , ( ) => {
321
321
// Prepare
322
322
process . env . TZ = 'America/New_York' ;
323
- /*
323
+ /*
324
324
Difference between UTC and `America/New_York`(GMT -04.00) is 240 minutes.
325
325
The positive value indicates that `America/New_York` is behind UTC.
326
326
*/
@@ -341,7 +341,7 @@ describe('Class: PowertoolsLogFormatter', () => {
341
341
process . env . TZ = 'America/New_York' ;
342
342
const mockDate = new Date ( '2016-06-20T12:08:10.910Z' ) ;
343
343
jest . useFakeTimers ( ) . setSystemTime ( mockDate ) ;
344
- /*
344
+ /*
345
345
Difference between UTC and `America/New_York`(GMT -04.00) is 240 minutes.
346
346
The positive value indicates that `America/New_York` is behind UTC.
347
347
*/
@@ -362,7 +362,7 @@ describe('Class: PowertoolsLogFormatter', () => {
362
362
process . env . TZ = 'America/New_York' ;
363
363
const mockDate = new Date ( '2016-06-20T00:08:10.910Z' ) ;
364
364
jest . useFakeTimers ( ) . setSystemTime ( mockDate ) ;
365
- /*
365
+ /*
366
366
Difference between UTC and `America/New_York`(GMT -04.00) is 240 minutes.
367
367
The positive value indicates that `America/New_York` is behind UTC.
368
368
*/
@@ -381,7 +381,7 @@ describe('Class: PowertoolsLogFormatter', () => {
381
381
test ( 'if `envVarsService` is not set, ensures timestamp is formatted to `UTC` even with `America/New_York` timezone' , ( ) => {
382
382
// Prepare
383
383
process . env . TZ = 'America/New_York' ;
384
- /*
384
+ /*
385
385
Difference between UTC and `America/New_York`(GMT -04.00) is 240 minutes.
386
386
The positive value indicates that `America/New_York` is behind UTC.
387
387
*/
@@ -471,6 +471,22 @@ describe('Class: PowertoolsLogFormatter', () => {
471
471
// Assess
472
472
expect ( timestamp ) . toEqual ( '2016-06-20T12:08:10.000Z' ) ;
473
473
} ) ;
474
+
475
+ test ( 'it is using UTC timezone when env var is set to :/etc/localtime' , ( ) => {
476
+ // Prepare
477
+ process . env . TZ = ':/etc/localtime' ;
478
+
479
+ jest . spyOn ( Date . prototype , 'getTimezoneOffset' ) . mockReturnValue ( 0 ) ;
480
+ const formatter = new PowertoolsLogFormatter ( {
481
+ envVarsService : new EnvironmentVariablesService ( ) ,
482
+ } ) ;
483
+
484
+ // Act
485
+ const timestamp = formatter . formatTimestamp ( new Date ( ) ) ;
486
+
487
+ // Assess
488
+ expect ( timestamp ) . toEqual ( '2016-06-20T12:08:10.000+00:00' ) ;
489
+ } ) ;
474
490
} ) ;
475
491
476
492
describe ( 'Method: getCodeLocation' , ( ) => {
0 commit comments