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

Pub authorization tests #857

Merged
merged 3 commits into from
Dec 19, 2024

Conversation

allisonking
Copy link
Contributor

@allisonking allisonking commented Dec 19, 2024

Issue(s) Resolved

Tests for #851

High-level Explanation of PR

Just a few tests for testing limiting pub visibility

Test Plan

Screenshots (if applicable)

Notes

@@ -0,0 +1,150 @@
import { describe, expect, it } from "vitest";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pulled this into its own file because pub.db.test.ts has an issue of its transactions not working properly, I think because we aren't dynamically importing seedCommunity. this meant that I'd query for pubs only to get pubs created by other tests in the file. so this separates it out, but we should fix pub.db.test.ts so we can run its tests without the tests bumping into each other

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separating it seems good for organization anyways!

@@ -1196,3 +1196,5 @@ export const createSeed = <
pubs?: PI;
forms?: F;
}) => props;

export type Seed = Parameters<typeof createSeed>[0];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can import types without problems and our transactions will work. importing createSeed the function, without doing a dynamic import in the test itself, seems to cause the data to persist though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smart!

@allisonking allisonking marked this pull request as ready for review December 19, 2024 17:40
@allisonking allisonking requested a review from kalilsn December 19, 2024 17:40
Copy link
Member

@kalilsn kalilsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like exactly what we needed and i'm relieved it seems to just work!

@allisonking allisonking merged commit 1dfa1cc into kalilsn/pub-authorization Dec 19, 2024
8 checks passed
@allisonking allisonking deleted the aking/pub-authorization-tests branch December 19, 2024 18:15
kalilsn pushed a commit that referenced this pull request Dec 21, 2024
* Initial tests

* Clean up a little
3mcd pushed a commit that referenced this pull request Jan 13, 2025
* Allow adding pub and stage members in seed function

Co-authored-by: Thomas F. K. Jorna <[email protected]>

* Fix seed scripts

* Filter pub results when userId is passed

* Make tests pass

* Add todo comment for making getPubs safer

* Fetch and use user in api for filtering pubs

* Pass user to get pubs query whenever possible

* Restrict access to individual pub page

* Skip pub authorization filtering on form fill page since it's authorized by form membership

* Allow superadmins to see all pubs

* Pub authorization tests (#857)

* Initial tests

* Clean up a little

* Remove redundant stage capability check

* Delete integrations from pub page and stop generating token on render

* Pub membership test (#858)

* Make sure related pubs show up regardless of authorization

* Fix missing import

---------

Co-authored-by: Thomas F. K. Jorna <[email protected]>
Co-authored-by: Allison King <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants