File tree 2 files changed +37
-2
lines changed
2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ function isEqual(a, b) {
109
109
a . Subtype === b . Subtype &&
110
110
a . Params . CheckSum . toString ( ) === b . Params . CheckSum . toString ( ) &&
111
111
a . Params . Size === b . Params . Size &&
112
- a . Params . CreationDate === b . Params . CreationDate &&
113
- a . Params . ModDate === b . Params . ModDate
112
+ a . Params . CreationDate . getTime ( ) === b . Params . CreationDate . getTime ( ) &&
113
+ a . Params . ModDate . getTime ( ) === b . Params . ModDate . getTime ( )
114
114
) ;
115
115
}
Original file line number Diff line number Diff line change @@ -192,6 +192,41 @@ describe('file', () => {
192
192
(file2.txt) 11 0 R
193
193
]
194
194
>>
195
+ >>`
196
+ ] ) ;
197
+ } ) ;
198
+
199
+ test ( 'attach the same file multiple times' , ( ) => {
200
+ const docData = logData ( document ) ;
201
+
202
+ document . file ( Buffer . from ( 'example text' ) , {
203
+ name : 'file1.txt' ,
204
+ creationDate : date ,
205
+ modifiedDate : date
206
+ } ) ;
207
+ document . file ( Buffer . from ( 'example text' ) , {
208
+ name : 'file1.txt' ,
209
+ creationDate : new Date ( date ) ,
210
+ modifiedDate : new Date ( date )
211
+ } ) ;
212
+ document . end ( ) ;
213
+
214
+ const numFiles = docData . filter ( ( str ) => typeof str === 'string' && str . startsWith ( '<<\n/Type /EmbeddedFile\n' ) )
215
+
216
+ expect ( numFiles . length ) . toEqual ( 1 )
217
+
218
+ expect ( docData ) . toContainChunk ( [
219
+ `2 0 obj` ,
220
+ `<<
221
+ /Dests <<
222
+ /Names [
223
+ ]
224
+ >>
225
+ /EmbeddedFiles <<
226
+ /Names [
227
+ (file1.txt) 10 0 R
228
+ ]
229
+ >>
195
230
>>`
196
231
] ) ;
197
232
} ) ;
You can’t perform that action at this time.
0 commit comments