Skip to content

Commit

Permalink
fix(app, ios): firebase-ios-sdk 10.2.0
Browse files Browse the repository at this point in the history
- UTM parameters come through now on dynamic links, adjust tests
- firestore handles writes to deleted docs slightly differently, adjust tests
- repair test assertion failure structures that did not trigger promise rejects
  • Loading branch information
mikehardy committed Nov 16, 2022
1 parent 0febbd1 commit 443f460
Show file tree
Hide file tree
Showing 5 changed files with 225 additions and 188 deletions.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Open your projects `/ios/Podfile` and add any of the globals shown below to the

```ruby
# Override Firebase SDK Version
$FirebaseSDKVersion = '10.1.0'
$FirebaseSDKVersion = '10.2.0'
```

Once changed, reinstall your projects pods via pod install and rebuild your project with `npx react-native run-ios`.
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
"sdkVersions": {
"ios": {
"firebase": "10.1.0",
"firebase": "10.2.0",
"iosTarget": "11.0",
"macosTarget": "10.13"
},
Expand Down
16 changes: 14 additions & 2 deletions packages/dynamic-links/e2e/dynamicLinks.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,13 @@ describe('dynamicLinks()', function () {
link.utmParameters.utm_medium.should.equal('web');
link.utmParameters.utm_campaign.should.equal('prs-welcome');
} else {
link.utmParameters.should.eql({});
link.utmParameters.should.eql({
utm_campaign: null,
utm_term: null,
utm_content: null,
utm_medium: null,
utm_source: null,
});
}
});
});
Expand Down Expand Up @@ -230,7 +236,13 @@ describe('dynamicLinks()', function () {
link.utmParameters.utm_medium.should.equal('web');
link.utmParameters.utm_campaign.should.equal('prs-welcome');
} else {
link.utmParameters.should.eql({});
link.utmParameters.should.eql({
utm_campaign: null,
utm_term: null,
utm_content: null,
utm_medium: null,
utm_source: null,
});
}
} else {
this.skip();
Expand Down
75 changes: 50 additions & 25 deletions packages/firestore/e2e/firestore.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,17 @@ describe('firestore()', function () {
describe('serverTimestampBehavior', function () {
it("handles 'estimate'", async function () {
firebase.firestore().settings({ serverTimestampBehavior: 'estimate' });
const ref = firebase.firestore().doc(`${COLLECTION}/getData`);
const ref = firebase.firestore().doc(`${COLLECTION}/serverTimestampEstimate`);

const promise = new Promise((resolve, reject) => {
const subscription = ref.onSnapshot(snapshot => {
should(snapshot.get('timestamp')).be.an.instanceOf(firebase.firestore.Timestamp);
subscription();
resolve();
try {
should(snapshot.get('timestamp')).be.an.instanceOf(firebase.firestore.Timestamp);
subscription();
resolve();
} catch (e) {
reject(e);
}
}, reject);
});

Expand All @@ -218,28 +222,33 @@ describe('firestore()', function () {
});
it("handles 'previous'", async function () {
firebase.firestore().settings({ serverTimestampBehavior: 'previous' });
const ref = firebase.firestore().doc(`${COLLECTION}/getData`);
const ref = firebase.firestore().doc(`${COLLECTION}/serverTimestampPrevious`);

const promise = new Promise((resolve, reject) => {
let counter = 0;
let previous = null;
const subscription = ref.onSnapshot(snapshot => {
switch (counter++) {
case 0:
break;
case 1:
should(snapshot.get('timestamp')).be.an.instanceOf(firebase.firestore.Timestamp);
break;
case 2:
should(snapshot.get('timestamp')).be.an.instanceOf(firebase.firestore.Timestamp);
should(snapshot.get('timestamp').isEqual(previous.get('timestamp'))).equal(true);
break;
case 3:
should(snapshot.get('timestamp')).be.an.instanceOf(firebase.firestore.Timestamp);
should(snapshot.get('timestamp').isEqual(previous.get('timestamp'))).equal(false);
subscription();
resolve();
break;
try {
switch (counter++) {
case 0:
should(snapshot.get('timestamp')).equal(null);
break;
case 1:
should(snapshot.get('timestamp')).be.an.instanceOf(firebase.firestore.Timestamp);
break;
case 2:
should(snapshot.get('timestamp')).be.an.instanceOf(firebase.firestore.Timestamp);
should(snapshot.get('timestamp').isEqual(previous.get('timestamp'))).equal(true);
break;
case 3:
should(snapshot.get('timestamp')).be.an.instanceOf(firebase.firestore.Timestamp);
should(snapshot.get('timestamp').isEqual(previous.get('timestamp'))).equal(false);
subscription();
resolve();
break;
}
} catch (e) {
reject(e);
}
previous = snapshot;
}, reject);
Expand All @@ -253,13 +262,29 @@ describe('firestore()', function () {
});
it("handles 'none'", async function () {
firebase.firestore().settings({ serverTimestampBehavior: 'none' });
const ref = firebase.firestore().doc(`${COLLECTION}/getData`);
const ref = firebase.firestore().doc(`${COLLECTION}/serverTimestampNone`);

const promise = new Promise((resolve, reject) => {
let counter = 0;
const subscription = ref.onSnapshot(snapshot => {
should(snapshot.get('timestamp')).equal(null);
subscription();
resolve();
try {
switch (counter++) {
case 0:
// The initial callback snapshot should have no value for the timestamp, it has not been set at all
should(snapshot.get('timestamp')).equal(null);
break;
case 1:
should(snapshot.get('timestamp')).be.an.instanceOf(firebase.firestore.Timestamp);
subscription();
resolve();
break;
default:
// there should only be initial callback and set callback, any other callbacks are a fail
reject(new Error('too many callbacks'));
}
} catch (e) {
reject(e);
}
}, reject);
});

Expand Down
Loading

0 comments on commit 443f460

Please sign in to comment.