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

Refactor tests for team rights #207

Open
1 of 4 tasks
GoldenJaden opened this issue Feb 26, 2024 · 0 comments
Open
1 of 4 tasks

Refactor tests for team rights #207

GoldenJaden opened this issue Feb 26, 2024 · 0 comments
Assignees
Labels
Tests This issue is related to writing or modifying tests

Comments

@GoldenJaden
Copy link
Contributor

GoldenJaden commented Feb 26, 2024

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

  • 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
@GoldenJaden GoldenJaden self-assigned this Feb 29, 2024
@GoldenJaden GoldenJaden changed the title Refactor tests for team rights in note.test.ts Refactor tests for team rights Feb 29, 2024
@GoldenJaden GoldenJaden added the Tests This issue is related to writing or modifying tests label Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tests This issue is related to writing or modifying tests
Projects
None yet
Development

No branches or pull requests

1 participant