Skip to content
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

FR: rule-unit-testing's withSecurityRulesDisabled method JSDoc incorrect #6668

Open
palmerusaf opened this issue Oct 8, 2022 · 2 comments
Open

Comments

@palmerusaf
Copy link

[REQUIRED] Describe your environment

  • Operating System version: Pop OS 22.04 LTS
  • Browser version: Firefox 105.0.1
  • Firebase SDK version: 9.10.0
  • Firebase Product: rules unit testing (auth, database, storage, etc)

[REQUIRED] Describe the problem

Steps to reproduce:

The method withSecurityRulesDisabled has no documentation. After digging, it turns out it does have documentation but it is missing a * to make it a JS doc, resulting in the doc being a comment. This means the api extractor never picks it up during build.

Relevant Code:

The relevant line is here.

I would like to submit a PR to correct the issue. Also, I would like to include an example in the JS Doc to add clarity, since this method differs from the other context methods. I plan on including the following example.

const addTestData = async ({ testEnv, collectionName, testData }) => {
  let docId;
  await testEnv.withSecurityRulesDisabled(async (noRulesContext) => {
    const db = await noRulesContext.firestore();
    const dbCollection = collection(db, collectionName);
    docId = await (await addDoc(dbCollection, testData)).id;
  });
  return docId;
};

I ran the script yarn docgen devsite and everything looks ok. Let me know if I'm missing anything or if I should use a different example.
Here's a link to my proposed change.

@hsubox76
Copy link
Contributor

Thanks, feel free to make a PR. I was going to add a comment that there needs to be a - after @param callback - that line is outside of your change but your fix made this error visible.

@palmerusaf
Copy link
Author

@hsubox76 Good catch. I've updated the commit to include your correction and submitted a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants