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

fix: TestAgent not inheriting Agent properties #834

Merged
merged 1 commit into from
Apr 24, 2024
Merged

fix: TestAgent not inheriting Agent properties #834

merged 1 commit into from
Apr 24, 2024

Conversation

Bruception
Copy link

@Bruception Bruception commented Apr 24, 2024

#833

Checklist

  • I have ensured my pull request is not behind the main or master branch of the original repository.
  • I have rebased all commits where necessary so that reviewing this pull request can be done without having to merge it first.
  • I have written a commit message that passes commitlint linting.
  • I have ensured that my code changes pass linting tests.
  • I have ensured that my code changes pass unit tests.
  • I have described my pull request and the reasons for code changes along with context if necessary.

@@ -26,7 +26,9 @@ const Test = require('./test.js');
function TestAgent(app, options = {}) {
if (!(this instanceof TestAgent)) return new TestAgent(app, options);

Agent.call(this, options);
const agent = new Agent(options);
Copy link
Author

@Bruception Bruception Apr 24, 2024

Choose a reason for hiding this comment

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

Looks like this commit to change from functions to classes breaks this behavior.
ladjs/superagent@fca95a3

The apply hook in the Proxy seems to discard the this reference and so it is not being binded.

Copy link

Choose a reason for hiding this comment

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

This looks promising (and explanation makes sense) 👀

@Bruception Bruception changed the title Fix TestAgent not inheriting Agent properties fix:TestAgent not inheriting Agent properties Apr 24, 2024
@Bruception Bruception changed the title fix:TestAgent not inheriting Agent properties fix: TestAgent not inheriting Agent properties Apr 24, 2024
@titanism titanism merged commit 225118c into ladjs:master Apr 24, 2024
2 checks passed
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