cloudflare:test vitest integration. See: https://lumenize.com/docs/testing/usage#basic-usage. Example:routeDORequest. I recommend the whitelist approach. See: https://lumenize.com/docs/utils/route-do-request#cors-supportagents dependency, but good to knowagents SDK isn't documented anywhere in the docs except for the changelog where it was introducedagents. The team has traditionally not consider docs (or quality, responsiveness on Discord, etc.) important although they say they are working on improving them. Also, it must be said that they have always had a great API design, even if you have to crawl in the code to discern it./cfrole@lumenize/testingjson-rpc-mixinjson-rpc-mixinjson-rpc-mixinjson-rpc-mixinrouteAgentRequest{ cors: true }{ cors: true }lumenize{ cors: false}it('shows basic 5-step test', async () => {
// 1. Create RPC testing client and Browser instance
await using client = createTestingClient<MyDOType>('MY_DO', '5-step');
const browser = new Browser();
// 2. Pre-populate storage via RPC to call asycn KV API
await client.ctx.storage.put('count', 10);
// 3. Make a fetch and RPC call to increment
const resp = await browser.fetch('https://test.com/my-do/5-step/increment');
const rpcResult = await client.increment();
// 4. Confirm that results are as expected
expect(await resp.text()).toBe('11');
expect(rpcResult).toBe(12); // Notice this is a number not a string
// 5. Verify that storage is correct via RPC
expect(await client.ctx.storage.kv.get('count')).toBe(12);
});