We do have a Netlify Edge Function already in website/netlify/edge-functions at master · asyncapi/website · GitHub.
But there are no tests yet. We need to investigate how we can test that, since the runtime is Deno and there are some additions Netlify does on their runtime.
Is there any this can be done?
I believe the only way to test those would be using Netlify CLI. You’d have to start Netlify CLI, use a headless browser like Puppeteer, visit the path with the Edge Functions, and check for expected response.
Is there no other way like running tests for Deno or something as we wouldn’t want to overload our actions with headless browsers?
Testing individual Edge Functions in isolation is doable by importing the raw source file, feeding the function a
Request and asserting on the
Response. You’d need to mock out the
context , but apart from
context.next() that should be pretty easy.
If you want to test multiple functions in interplay, we don’t have a good story for that.