From 689add652ae522793e98c81f5b8071815e90e20f Mon Sep 17 00:00:00 2001 From: Tobi Date: Mon, 2 Mar 2020 12:01:16 +0100 Subject: [PATCH] test: fake timers with sinon --- CHANGELOG.md | 1 + test/unit/timestamp.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c37f562..ce2f13c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 behavior of `onAuthStateChanged()` (see below) - Support for Firebase Messaging (Admin API) - Support for [FieldValue.increment](https://firebase.google.com/docs/reference/js/firebase.firestore.FieldValue#increment) +- Support for [firestore.Timestamp.now()](https://firebase.google.com/docs/reference/js/firebase.firestore.Timestamp#now) ### Changed - (Breaking) Consistent with Firebase SDK [version 4.0.0](https://firebase.google.com/support/release-notes/js#version_500_-_may_8_2018) and later, diff --git a/test/unit/timestamp.js b/test/unit/timestamp.js index 20b6f2f..7dc3c40 100644 --- a/test/unit/timestamp.js +++ b/test/unit/timestamp.js @@ -5,6 +5,14 @@ var sinon = require('sinon'); var Timestamp = require('../../src/timestamp'); describe('Timestamp', function () { + var clock; + beforeEach(function () { + clock = sinon.useFakeTimers(); + }); + afterEach(function () { + clock.restore(); + }); + describe('fromDate', function () { it('should convert from date', function () { var date = new Date('2009-02-13T23:31:30.123456789Z');