@@ -29,8 +29,6 @@ type TimeZoneTest = {
29
29
description : string ;
30
30
serverTimeZone ?: string ;
31
31
exifData : Record < string , any > ;
32
- fileCreatedAt : Date ;
33
- fileModifiedAt : Date ;
34
32
expected : {
35
33
localDateTime : string ;
36
34
dateTimeOriginal : string ;
@@ -60,8 +58,6 @@ describe(MetadataService.name, () => {
60
58
const timeZoneTests : TimeZoneTest [ ] = [
61
59
{
62
60
description : 'should handle no time zone information' ,
63
- fileCreatedAt : new Date ( '2022-01-01T00:00:00.000Z' ) ,
64
- fileModifiedAt : new Date ( '2022-01-01T00:00:00.000Z' ) ,
65
61
exifData : {
66
62
DateTimeOriginal : '2022:01:01 00:00:00' ,
67
63
} ,
@@ -73,8 +69,6 @@ describe(MetadataService.name, () => {
73
69
} ,
74
70
{
75
71
description : 'should handle no time zone information and server behind UTC' ,
76
- fileCreatedAt : new Date ( '2022-01-01T00:00:00.000Z' ) ,
77
- fileModifiedAt : new Date ( '2022-01-01T00:00:00.000Z' ) ,
78
72
serverTimeZone : 'America/Los_Angeles' ,
79
73
exifData : {
80
74
DateTimeOriginal : '2022:01:01 00:00:00' ,
@@ -87,8 +81,6 @@ describe(MetadataService.name, () => {
87
81
} ,
88
82
{
89
83
description : 'should handle no time zone information and server ahead of UTC' ,
90
- fileCreatedAt : new Date ( '2022-01-01T00:00:00.000Z' ) ,
91
- fileModifiedAt : new Date ( '2022-01-01T00:00:00.000Z' ) ,
92
84
serverTimeZone : 'Europe/Brussels' ,
93
85
exifData : {
94
86
DateTimeOriginal : '2022:01:01 00:00:00' ,
@@ -101,8 +93,6 @@ describe(MetadataService.name, () => {
101
93
} ,
102
94
{
103
95
description : 'should handle no time zone information and server ahead of UTC in the summer' ,
104
- fileCreatedAt : new Date ( '2022-01-01T00:00:00.000Z' ) ,
105
- fileModifiedAt : new Date ( '2022-01-01T00:00:00.000Z' ) ,
106
96
serverTimeZone : 'Europe/Brussels' ,
107
97
exifData : {
108
98
DateTimeOriginal : '2022:06:01 00:00:00' ,
@@ -115,8 +105,6 @@ describe(MetadataService.name, () => {
115
105
} ,
116
106
{
117
107
description : 'should handle a +13:00 time zone' ,
118
- fileCreatedAt : new Date ( '2022-01-01T00:00:00.000Z' ) ,
119
- fileModifiedAt : new Date ( '2022-01-01T00:00:00.000Z' ) ,
120
108
exifData : {
121
109
DateTimeOriginal : '2022:01:01 00:00:00+13:00' ,
122
110
} ,
@@ -128,32 +116,26 @@ describe(MetadataService.name, () => {
128
116
} ,
129
117
] ;
130
118
131
- it . each ( timeZoneTests ) (
132
- '$description' ,
133
- async ( { exifData, serverTimeZone, expected, fileCreatedAt, fileModifiedAt } ) => {
134
- // TODO: the TZ environment variable is no longer used, remove it
135
- process . env . TZ = serverTimeZone ?? undefined ;
119
+ it . each ( timeZoneTests ) ( '$description' , async ( { exifData, serverTimeZone, expected } ) => {
120
+ process . env . TZ = serverTimeZone ?? undefined ;
136
121
137
- const { filePath } = await createTestFile ( exifData ) ;
138
- assetMock . getByIds . mockResolvedValue ( [
139
- { id : 'asset-1' , originalPath : filePath , fileCreatedAt, fileModifiedAt } as AssetEntity ,
140
- ] ) ;
122
+ const { filePath } = await createTestFile ( exifData ) ;
123
+ assetMock . getByIds . mockResolvedValue ( [ { id : 'asset-1' , originalPath : filePath } as AssetEntity ] ) ;
141
124
142
- await sut . handleMetadataExtraction ( { id : 'asset-1' } ) ;
125
+ await sut . handleMetadataExtraction ( { id : 'asset-1' } ) ;
143
126
144
- expect ( assetMock . upsertExif ) . toHaveBeenCalledWith (
145
- expect . objectContaining ( {
146
- dateTimeOriginal : new Date ( expected . dateTimeOriginal ) ,
147
- timeZone : expected . timeZone ,
148
- } ) ,
149
- ) ;
127
+ expect ( assetMock . upsertExif ) . toHaveBeenCalledWith (
128
+ expect . objectContaining ( {
129
+ dateTimeOriginal : new Date ( expected . dateTimeOriginal ) ,
130
+ timeZone : expected . timeZone ,
131
+ } ) ,
132
+ ) ;
150
133
151
- expect ( assetMock . update ) . toHaveBeenCalledWith (
152
- expect . objectContaining ( {
153
- localDateTime : new Date ( expected . localDateTime ) ,
154
- } ) ,
155
- ) ;
156
- } ,
157
- ) ;
134
+ expect ( assetMock . update ) . toHaveBeenCalledWith (
135
+ expect . objectContaining ( {
136
+ localDateTime : new Date ( expected . localDateTime ) ,
137
+ } ) ,
138
+ ) ;
139
+ } ) ;
158
140
} ) ;
159
141
} ) ;
0 commit comments