[tests][firestore] tweak test helpers to allow path/doc specifying
This commit is contained in:
parent
2e26858e3f
commit
8abafb8cd8
|
@ -75,34 +75,34 @@ module.exports = {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
},
|
},
|
||||||
|
|
||||||
testCollection() {
|
testCollection(collection) {
|
||||||
shouldCleanup = true;
|
shouldCleanup = true;
|
||||||
return firebase.firestore().collection(TEST_COLLECTION_NAME);
|
return firebase.firestore().collection(collection || TEST_COLLECTION_NAME);
|
||||||
},
|
},
|
||||||
|
|
||||||
testCollectionDoc() {
|
testCollectionDoc(path) {
|
||||||
shouldCleanup = true;
|
shouldCleanup = true;
|
||||||
return firebase.firestore().doc(module.exports.COL_DOC_1_PATH);
|
return firebase.firestore().doc(path);
|
||||||
},
|
},
|
||||||
|
|
||||||
testCollectionDocAdmin() {
|
testCollectionDocAdmin(path) {
|
||||||
shouldCleanup = true;
|
shouldCleanup = true;
|
||||||
return firebaseAdmin.firestore().doc(module.exports.COL_DOC_1_PATH);
|
return firebaseAdmin.firestore().doc(path);
|
||||||
},
|
},
|
||||||
|
|
||||||
resetTestCollectionDoc() {
|
resetTestCollectionDoc(path, doc) {
|
||||||
shouldCleanup = true;
|
shouldCleanup = true;
|
||||||
return firebase
|
return firebase
|
||||||
.firestore()
|
.firestore()
|
||||||
.doc(module.exports.COL_DOC_1_PATH)
|
.doc(path || module.exports.COL_DOC_1_PATH)
|
||||||
.set(module.exports.COL_DOC_1());
|
.set(doc || module.exports.COL_DOC_1());
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// call a get request without waiting to force firestore to connect
|
// call a get request without waiting to force firestore to connect
|
||||||
// so the first test isn't delayed whilst connecting
|
// so the first test isn't delayed whilst connecting
|
||||||
module.exports
|
module.exports
|
||||||
.testCollectionDocAdmin()
|
.testCollectionDocAdmin(module.exports.DOC_1_PATH)
|
||||||
.get()
|
.get()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
|
|
Loading…
Reference in New Issue