File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 20
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
// SOFTWARE.
22
22
23
+ import * as admin from 'firebase-admin' ;
24
+
23
25
import * as firestore from '../../src/providers/firestore' ;
24
26
import * as _ from 'lodash' ;
25
27
import { expect } from 'chai' ;
@@ -428,7 +430,9 @@ describe('Firestore Functions', () => {
428
430
} )
429
431
) ;
430
432
expect ( snapshot . data ( ) ) . to . deep . equal ( {
431
- timestampVal : new Date ( '2017-06-13T00:58:40.349Z' ) ,
433
+ timestampVal : admin . firestore . Timestamp . fromDate (
434
+ new Date ( '2017-06-13T00:58:40.349Z' )
435
+ ) ,
432
436
} ) ;
433
437
} ) ;
434
438
@@ -444,7 +448,9 @@ describe('Firestore Functions', () => {
444
448
} )
445
449
) ;
446
450
expect ( snapshot . data ( ) ) . to . deep . equal ( {
447
- timestampVal : new Date ( '2017-06-13T00:58:40Z' ) ,
451
+ timestampVal : admin . firestore . Timestamp . fromDate (
452
+ new Date ( '2017-06-13T00:58:40Z' )
453
+ ) ,
448
454
} ) ;
449
455
} ) ;
450
456
Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ export function snapshotConstructor(event: Event): DocumentSnapshot {
161
161
export function beforeSnapshotConstructor ( event : Event ) : DocumentSnapshot {
162
162
if ( ! firestoreInstance ) {
163
163
firestoreInstance = firebase . firestore ( apps ( ) . admin ) ;
164
+ firestoreInstance . settings ( { timestampsInSnapshots : true } ) ;
164
165
}
165
166
let oldValueProto = _getValueProto (
166
167
event . data ,
You can’t perform that action at this time.
0 commit comments