Skip to content

example code passes incorrectly #334

Open
@bswhite1

Description

@bswhite1

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');
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions