Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
milaGGL committed Oct 27, 2022
1 parent d9e30a2 commit d93d965
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/firestore/test/integration/api/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,20 +636,20 @@ apiDescribe('Database transactions', (persistence: boolean) => {

await runTransaction(db, async transaction => {
++retryCounter;
const snap1 = await transaction.get(docRef);
const snap = await transaction.get(docRef);

if (retryCounter === 1) {
expect(snap1.exists()).to.be.false;
// On the first attemp, create a doc before transaction.set(), so that
expect(snap.exists()).to.be.false;
// On the first attempt, create a doc before transaction.set(), so that
// the transaction fails with "already-exists" error, and retries.
await setDoc(docRef, { count: 1 });
}

transaction.set(docRef, { count: 2 });
});
expect(retryCounter).to.equal(2);
const result = await getDoc(docRef);
expect(result.get('count')).to.equal(2);
const snap = await getDoc(docRef);
expect(snap.get('count')).to.equal(2);
});
});

Expand Down

0 comments on commit d93d965

Please sign in to comment.