|
1 | | -import { |
2 | | - createSnapshot, |
3 | | - extractRefs |
4 | | -} from '../src/utils' |
5 | | -import { |
6 | | - Key, |
7 | | - db, |
8 | | - _id, |
9 | | - DocumentReference, |
10 | | - DocumentSnapshot |
11 | | -} from './helpers' |
| 1 | +import { createSnapshot, extractRefs } from '../src/utils' |
| 2 | +import { Key, db, _id, DocumentReference, GeoPoint, DocumentSnapshot } from './helpers' |
12 | 3 |
|
13 | 4 | let id, doc, snapshot, collection, docRef |
14 | 5 | beforeEach(() => { |
@@ -60,8 +51,19 @@ test('leave Date objects alone when extracting refs', () => { |
60 | 51 | foo: 1, |
61 | 52 | bar: d |
62 | 53 | }) |
63 | | - expect(doc.foo).toEqual(1) |
64 | | - expect(doc.bar).toEqual(d) |
| 54 | + expect(doc.foo).toBe(1) |
| 55 | + expect(doc.bar).toBe(d) |
| 56 | + expect(refs).toEqual({}) |
| 57 | +}) |
| 58 | + |
| 59 | +test('leave GeoPoint objects alone when extracting refs', () => { |
| 60 | + const d = new GeoPoint(2, 48) |
| 61 | + const [doc, refs] = extractRefs({ |
| 62 | + foo: 1, |
| 63 | + bar: d |
| 64 | + }) |
| 65 | + expect(doc.foo).toBe(1) |
| 66 | + expect(doc.bar).toBe(d) |
65 | 67 | expect(refs).toEqual({}) |
66 | 68 | }) |
67 | 69 |
|
@@ -99,11 +101,7 @@ test('extracts refs from array', async () => { |
99 | 101 | index: 0 |
100 | 102 | }) |
101 | 103 | const [noRefsDoc, refs] = extractRefs({ |
102 | | - arr: [ |
103 | | - docRef, |
104 | | - docRef2, |
105 | | - docRef |
106 | | - ] |
| 104 | + arr: [docRef, docRef2, docRef] |
107 | 105 | }) |
108 | 106 | expect(noRefsDoc.arr[0]).toEqual(docRef.path) |
109 | 107 | expect(noRefsDoc.arr[1]).toEqual(docRef2.path) |
|
0 commit comments