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

example code passes incorrectly #334

Open
bswhite1 opened this issue Aug 29, 2023 · 0 comments
Open

example code passes incorrectly #334

bswhite1 opened this issue Aug 29, 2023 · 0 comments

Comments

@bswhite1
Copy link

bswhite1 commented Aug 29, 2023

The function, expectPermissionGetSucceeds, can pass when it shouldn't.

export async function expectPermissionGetSucceeds(promise: Promise<any>) {

If your READ permissions return a PERMISSION_DENIED, then the getDoc promise will return the error code. however since this only expects that promise.not.toBeUndefined, then the error code meets that criteria.

I fixed locally by just adding the second check to make sure that the error code != PERMISSION_DENIED

export async function expectPermissionGetSucceeds(promise: Promise<any>) {
  const successResult = await assertSucceeds(promise);
  expect(successResult).not.toBeUndefined();
  expect(successResult.code).not.toBe('permission-denied' || 'PERMISSION_DENIED');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant