-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix(e2e): Update E2E tests for recent permissions changes #2247
Conversation
a34982e
to
ac363db
Compare
@@ -73,5 +72,11 @@ | |||
}, | |||
"settings": { | |||
"jest": { "version": 27 } | |||
} | |||
}, | |||
"overrides": [ |
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.
This config update means that these linting rules will only apply to test files - I was getting a linting error from testing-library/react
for using the client.user.getById()
which shares a name with a testing-library
function.
Docs: https://github.com/testing-library/eslint-plugin-testing-library#eslint-overrides
email: string; | ||
isPlatformAdmin: boolean; | ||
teams: UserTeams[]; | ||
user?: User |
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.
`, | ||
variables: { email }, | ||
}); | ||
if (this.getUser()) return; |
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.
Checking this means we now don't run this query on each route change, just on initial page load.
Removed vultr server and associated DNS entries |
}); | ||
}); | ||
}); | ||
|
||
it("returns an error for an invalid email address", async () => { | ||
mockGetByEmail.mockResolvedValueOnce(null); | ||
mockGetById.mockResolvedValueOnce(null); | ||
|
||
await supertest(app) | ||
.get("/me") | ||
.set(authHeader({ role: "teamEditor" })) |
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.
👍
- Remove redundant email from JWT, rely on ID - Update API tests - Update /me route
- Only init user store once - Update Header to use store for username - Avoid zustand namespace clashes in user store
c52982b
to
aca10fd
Compare
Implemented in theopensystemslab/planx-new#2247
What does this PR do?
What was the issue?
email
was added to the JWT in the API, but not in the e2e tests - commit 56e91c9 has a quick fix for this.email
was only added to the token to make things less noisy in another PR - I've just made the update to rely on the ID by using theuser.getById()
method introduced here - theopensystemslab/planx-core#143Apologies for the commit with linting issues - I'll take a look at Husky today and try to work out what the issues is here.