firebase / firebase/firebase-js-sdk

assertSucceeds is typed as 'any' (probably should be promise)

Open
#4,622 1 comment 0 reactions 0 assignees View on GitHub
api: firestore needs-attention question testing-sdk
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### [REQUIRED] Describe your environment

* Operating System version: Windows 10
* Browser version: irrelevant
* Firebase SDK version: 3/11/2021
* Firebase Product: rules unit testing against firestore

### [REQUIRED] Describe the problem

Was having difficulty getting some security rules tests against firestore working. Basically my test outcome seemed immune from changes to the rules file. Anyway started to wonder if I was using `assertSucceeds` correctly. I wasn't sure if I should await a response or call it synchronously. I looked at the typings on this and it returns `any` but clearly should return a promise instead. This has made debugging my problem more confusing/difficult.

#### Relevant Code:

Here is the exported function from file https://github.com/firebase/firebase-js-sdk/blob/97f26b7168a2765618c7469f5ed1bf86b7c4ee7e/packages/rules-unit-testing/src/api/index.ts

```javascript
export function assertSucceeds(pr: Promise): any {
return pr;
}
```

Same issue with `assertFails`. Shouldn't these be typed more specifically than `any`?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.