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

test(netlify-edge): add tests #2897

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

serhalp
Copy link
Contributor

@serhalp serhalp commented Nov 20, 2024

πŸ”— Linked issue

N/A

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

The netlify-edge preset has no tests. This adds tests.

Previously added in #2822 but cut out before merging.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@serhalp serhalp requested a review from pi0 as a code owner November 20, 2024 19:57
Comment on lines +231 to +233
// netlify-edge intentionally ignores prerendered routes
it.skipIf(ctx.preset === "netlify-edge")(
"prerendered API routes work",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pi0 I believe you didn't like this in the original PR. Let me know if you have any other ideas 🀷🏼.

Copy link
Member

Choose a reason for hiding this comment

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

prerendered routes are basically static assets. Maybe worth to implement small stub in request handler that emulates netlify edge behavior? (otherwise current hotfix if allows to move it forward faster is good enough IMO -- we can do later)

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

thanks for work on this ❀️

};
return async ({ url: rawRelativeUrl, headers, method, body }) => {
// creating new URL object to parse query easier
const url = new URL(`https://example.com${rawRelativeUrl}`);
Copy link
Member

Choose a reason for hiding this comment

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

Can we use newURL(rawRelativeUrl, headers['host'])? (right now we don't have host tests I guess but it might fail later and need the right fix.

Comment on lines +231 to +233
// netlify-edge intentionally ignores prerendered routes
it.skipIf(ctx.preset === "netlify-edge")(
"prerendered API routes work",
Copy link
Member

Choose a reason for hiding this comment

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

prerendered routes are basically static assets. Maybe worth to implement small stub in request handler that emulates netlify edge behavior? (otherwise current hotfix if allows to move it forward faster is good enough IMO -- we can do later)

pi0

This comment was marked as duplicate.

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.

2 participants