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(functions): Mock context in function test template #10555

Merged
merged 4 commits into from
May 9, 2024

Conversation

Tobbe
Copy link
Member

@Tobbe Tobbe commented May 9, 2024

Currently if you switch on TypeScript strict mode in a Redwood project you will get red squiggles in our default function tests that we create when users generate new functions.

It looks like this
image

The fix is simple, and is the right thing to do no matter if TS strict mode is enabled or not (or if it's even a TS project or a JS project). We already have a function to properly mock the Context, so let's just use that!

@Tobbe Tobbe added the release:fix This PR is a fix label May 9, 2024
@Tobbe Tobbe added this to the next-release-patch milestone May 9, 2024
@Tobbe Tobbe merged commit ee4e784 into redwoodjs:main May 9, 2024
46 checks passed
@Tobbe Tobbe deleted the tobbe-function-test-mock-context branch May 9, 2024 21:41
dac09 added a commit that referenced this pull request May 15, 2024
…uth-store

* 'main' of github.com:redwoodjs/redwood:
  chore(router): Add more code comments to analyzeRoutes (#10569)
  RSC: No need to use memo or useMemo in the server router (#10568)
  RSC: getViteConfig in rscWorker (#10567)
  Split RSC and RSA handling in rscWorker (#10565)
  RSC: Extract the fetchRSC function (#10564)
  RSC: Fix TODO regarding SSR in client.ts (#10562)
  Docs: QoL Updates to Contributing.md (#10561)
  Added warning note to not add WebAuthn (#10231)
  fix(rsc): Load all css links to support css with rsc (#10544)
  fix(cli): Add deprecation notice for edgio deployment (#10551)
  Define `process.env.NODE_ENV` in build process. (#10553)
  chore(docs): Update dbAuth and Supabase middleware READMEs (#10552)
  chore(deps): Upgrade React 19 to beta 20240508 (#10560)
  Revert "chore(deps): React beta 20240508 (#10558)" (#10559)
  chore(deps): React beta 20240508 (#10558)
  fix(functions): Fix context variable warning/error (#10556)
  fix(functions): Mock context in function test template (#10555)
  chore(middleware): Format code and comments and fix comment grammar (#10554)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix This PR is a fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants