Skip to content

gregfenton patch issue 221 #344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 22, 2023
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