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 2020// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121// SOFTWARE.
2222
23+ import * as admin from 'firebase-admin' ;
24+
2325import * as firestore from '../../src/providers/firestore' ;
2426import * as _ from 'lodash' ;
2527import { expect } from 'chai' ;
@@ -428,7 +430,9 @@ describe('Firestore Functions', () => {
428430 } )
429431 ) ;
430432 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+ ) ,
432436 } ) ;
433437 } ) ;
434438
@@ -444,7 +448,9 @@ describe('Firestore Functions', () => {
444448 } )
445449 ) ;
446450 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+ ) ,
448454 } ) ;
449455 } ) ;
450456
Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ export function snapshotConstructor(event: Event): DocumentSnapshot {
161161export function beforeSnapshotConstructor ( event : Event ) : DocumentSnapshot {
162162 if ( ! firestoreInstance ) {
163163 firestoreInstance = firebase . firestore ( apps ( ) . admin ) ;
164+ firestoreInstance . settings ( { timestampsInSnapshots : true } ) ;
164165 }
165166 let oldValueProto = _getValueProto (
166167 event . data ,
You can’t perform that action at this time.
0 commit comments