codex-team / codex-team/notes.api

Refactor tests for team rights

Aperta
#207 0 commenti 0 reazioni 1 assegnatario Rivendicata da @GoldenJaden Vedi su GitHub
Tests
Lingua principale
TypeScript
Stelle
4
Fork
2
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

# Problem
With the come of **team rights policies**, there are a lot of almost indentical tests that should be run for some routes.

# Solution
Parametrize tests that test team rights - make use of the `test.each` method to stuff similar test to one pack.

You can peek into the `note.settings.test.ts` to understand how it should be done.

Also, it would be nice to save this `test.each` as separate util for better convenience:
something like
```
test.roles = test.each([{ role: MemberRole.Read,
isPublic: false,
isAuthorized: true,
statusCode: 200 },
{ ... },
{ ... },
{ ... }
]);
```
and use it as
```
test.roles('Returns note with access rights by public id ....', ({ role, isPublic, isAuthorized, statusCode }) => {

})
```

# Tasks

- [x] Refactor tests regarding team rights
- [ ] Make the method as a separate util
- [ ] Find out how to make the better
naming for tests in `test.each` (from `jest` tool). Right now we have same name for all tests in one scope, and it's not very convenient.
- [ ] Update test docs

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.