-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
refactor: Add a few lint rules to test files in /spec
#9815
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -647,7 +647,6 @@ describe('Email Verification Token Expiration:', () => { | |
|
||
it_id('b6c87f35-d887-477d-bc86-a9217a424f53')(it)('setting the email on the user should set a new email verification token and new expiration date for the token when expire email verify token flag is set', async () => { | ||
const user = new Parse.User(); | ||
let userBeforeEmailReset; | ||
|
||
let sendEmailOptions; | ||
const sendPromise = resolvingPromise(); | ||
|
@@ -680,7 +679,7 @@ describe('Email Verification Token Expiration:', () => { | |
return results[0]; | ||
}); | ||
expect(typeof userFromDb).toBe('object'); | ||
userBeforeEmailReset = userFromDb; | ||
const userBeforeEmailReset = userFromDb; | ||
|
||
// trigger another token generation by setting the email | ||
user.set('email', '[email protected]'); | ||
|
@@ -713,7 +712,6 @@ describe('Email Verification Token Expiration:', () => { | |
const user = new Parse.User(); | ||
let sendEmailOptions; | ||
let sendVerificationEmailCallCount = 0; | ||
let userBeforeRequest; | ||
const promise1 = resolvingPromise(); | ||
const promise2 = resolvingPromise(); | ||
const emailAdapter = { | ||
|
@@ -748,7 +746,7 @@ describe('Email Verification Token Expiration:', () => { | |
return results[0]; | ||
}); | ||
// store this user before we make our email request | ||
userBeforeRequest = newUser; | ||
const userBeforeRequest = newUser; | ||
|
||
expect(sendVerificationEmailCallCount).toBe(1); | ||
|
||
|
@@ -1011,7 +1009,7 @@ describe('Email Verification Token Expiration:', () => { | |
}) | ||
.then(fail) | ||
.catch(response => response); | ||
|
||
expect(response.status).toBe(400); | ||
expect(sendVerificationEmailCallCount).toBe(0); | ||
expect(sendEmailOptions).not.toBeDefined(); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
💡 Verification agent
❓ Verification inconclusive
Avoid double-encoding the request body
lib/request
already JSON-serialises plain objects that are passed via thebody
field (see other tests in this file).Passing a pre-stringified payload here will therefore lead to a double JSON encoding on the wire:
which breaks the server-side deserialisation and defeats the purpose of the test.
Run the test suite after applying the patch – this part currently fails if the server expects a structured JSON object.
I’ll verify how
lib/request
handles thebody
field and check other tests inspec/CloudCode.spec.js
for examples of plain-object bodies.I’ll verify the
body
handling inlib/request
and how other tests use plain-object bodies:Avoid double-encoding the request body
lib/request
already JSON-serializes plain objects passed via thebody
field. Wrapping the payload inJSON.stringify
here causes a double-encoding on the wire and breaks server-side deserialization.Locations to update:
Required change:
Run the test suite after applying this patch to confirm the fix.
📝 Committable suggestion
🤖 Prompt for AI Agents