-
Notifications
You must be signed in to change notification settings - Fork 6
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
Pub authorization tests #857
Conversation
@@ -0,0 +1,150 @@ | |||
import { describe, expect, it } from "vitest"; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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]; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smart!
There was a problem hiding this 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!
* Initial tests * Clean up a little
* 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]>
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