Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions firestore/test.solution-counters.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function createCounter(ref, num_shards) {
// [END create_counter]

// [START increment_counter]
function incrementCounter(db, ref, num_shards) {
function incrementCounter(ref, num_shards) {
// Select a shard of the counter at random
const shard_id = Math.floor(Math.random() * num_shards).toString();
const shard_ref = ref.collection('shards').doc(shard_id);
Expand Down Expand Up @@ -67,15 +67,15 @@ describe("firestore-solution-counters", () => {
// Create a counter, then increment it
const ref = db.collection('counters').doc();
return createCounter(ref, 10).then(() => {
return incrementCounter(db, ref, 10);
return incrementCounter(ref, 10);
});
});

it("should get the count of a counter", () => {
// Create a counter, increment it, then get the count
const ref = db.collection('counters').doc();
return createCounter(ref, 10).then(() => {
return incrementCounter(db, ref, 10);
return incrementCounter(ref, 10);
}).then(() => {
return getCount(ref);
});
Expand Down