mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-01-12 22:50:20 +08:00
[tests][firestore] fix documentReference tests
This commit is contained in:
@@ -3,7 +3,7 @@ const {
|
||||
COL2_DOC_1,
|
||||
COL2_DOC_1_ID,
|
||||
COL2_DOC_1_PATH,
|
||||
TEST2_COLLECTION_NAME,
|
||||
TEST_COLLECTION_NAME_DYNAMIC,
|
||||
resetTestCollectionDoc,
|
||||
} = TestHelpers.firestore;
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('firestore()', () => {
|
||||
describe('parent', () => {
|
||||
it('should return parent collection', () => {
|
||||
const document = test2DocRef(COL2_DOC_1_ID);
|
||||
document.parent.id.should.equal(TEST2_COLLECTION_NAME);
|
||||
document.parent.id.should.equal(TEST_COLLECTION_NAME_DYNAMIC);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@ module.exports = {
|
||||
gaz: 12.1234567,
|
||||
geopoint: new firebase.firestore.GeoPoint(0, 0),
|
||||
naz: null,
|
||||
arrNumber: [1, 2, 3, 4],
|
||||
arrString: ['a', 'b', 'c', 'd'],
|
||||
object: {
|
||||
daz: 123,
|
||||
},
|
||||
@@ -115,7 +117,7 @@ module.exports = {
|
||||
shouldCleanup = true;
|
||||
return firebase
|
||||
.firestore()
|
||||
.collection(TEST_COLLECTION_NAME)
|
||||
.collection(TEST_COLLECTION_NAME_DYNAMIC)
|
||||
.doc(
|
||||
docId.startsWith(testRunId) || docId.endsWith(testRunId)
|
||||
? docId
|
||||
@@ -127,7 +129,7 @@ module.exports = {
|
||||
shouldCleanup = true;
|
||||
return firebase
|
||||
.firestore()
|
||||
.collection(TEST2_COLLECTION_NAME)
|
||||
.collection(TEST_COLLECTION_NAME_DYNAMIC)
|
||||
.doc(
|
||||
docId.startsWith(testRunId) || docId.endsWith(testRunId)
|
||||
? docId
|
||||
@@ -153,9 +155,7 @@ module.exports = {
|
||||
async resetTestCollectionDoc(path, doc) {
|
||||
shouldCleanup = true;
|
||||
const _doc = doc || module.exports.COL_DOC_1();
|
||||
|
||||
await module.exports.cleanCollection(TEST_COLLECTION_NAME_DYNAMIC);
|
||||
|
||||
await firebase
|
||||
.firestore()
|
||||
.doc(path || module.exports.COL_DOC_1_PATH)
|
||||
|
||||
Reference in New Issue
Block a user