Skip to content

Commit b6a9d64

Browse files
authored
v0.1.4 (#18)
* fix(callFirestore): only attach `createdBy` and `createdAt` in meta if they do not already exist * fix(callFirestore): parse `createdAt` to a timestamp (thanks to update of `firebase-tools-extra` to [`0.0.9`](https://github.com/prescottprue/firebase-tools-extra/releases/tag/v0.0.9))
1 parent bd8d5f3 commit b6a9d64

File tree

3 files changed

+28
-24
lines changed

3 files changed

+28
-24
lines changed

package-lock.json

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cypress-firebase",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"description": "Utilities to help testing Firebase projects with Cypress.",
55
"main": "lib/index.js",
66
"module": "lib/index.js",
@@ -28,7 +28,7 @@
2828
"commander": "^2.19.0",
2929
"figures": "^2.0.0",
3030
"firebase-admin": "^7.0.0",
31-
"firebase-tools-extra": "^0.0.8",
31+
"firebase-tools-extra": "^0.0.9",
3232
"lodash": "^4.17.11"
3333
},
3434
"devDependencies": {

src/attachCustomCommands.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,12 @@ export default function({ Cypress, cy, firebase }) {
152152

153153
// Add metadata to dataToWrite if specified by options
154154
if (isObject(data) && opts.withMeta) {
155-
dataToWrite.createdBy = Cypress.env('TEST_UID');
156-
dataToWrite.createdAt = firebase.firestore.FieldValue.serverTimestamp();
155+
if (!dataToWrite.createdBy) {
156+
dataToWrite.createdBy = Cypress.env('TEST_UID');
157+
}
158+
if (!dataToWrite.createdAt) {
159+
dataToWrite.createdAt = new Date().toISOString();
160+
}
157161
}
158162

159163
const firestoreCommand = buildFirestoreCommand(

0 commit comments

Comments
 (0)