Testing
FetchApplication is the application as a platform's entry calls it, without a platform:
final function = FetchApplication(() => springApplication);
final response = await function.fetch(
FetchRequest('GET', Uri.parse('https://example.com/books')),
environment: {'GREETING': 'hello'},
);
expect(response.status, 200);
await function.close();
A FetchRequest is a method, a URI, headers and a body; the environment is what the platform's environment would be; the answer is a FetchResponse.
function.scheduled(EdgeScheduledEvent(time: ...)) runs the scheduled handlers the same way (see Work by a schedule).
The package's own tests
The starter's own tests run its test function (example/) with one set of checks (test/platform_checks.dart) in every runtime it can have on a developer's machine, as JavaScript and as WebAssembly:
| Where | What runs the function |
|---|---|
| the Dart VM | FetchApplication |
| AWS Lambda | Node with the entry called by events (function URL, API Gateway, load balancer, EventBridge), and AWS's Lambda runtime image |
| Cloudflare Workers | workerd (wrangler dev), with a KV namespace, a D1 database and a cron trigger |
| Supabase | the Edge Runtime of the Supabase CLI's stack, behind its gateway |
| Deno Deploy, Netlify | Deno |
| Vercel | Node |
Not run there: the platforms themselves (a deployed function). The response-streaming handler of AWS is checked with a stand-in for the runtime's awslambda: AWS's emulator does not stream.