import nodejs from '../dist/index.js'; import { loadFixture, createRequestAndResponse } from './test-utils.js'; import { expect } from 'chai'; describe('API routes', () => { /** @type {import('./test-utils').Fixture} */ let fixture; before(async () => { fixture = await loadFixture({ root: './fixtures/locals/', output: 'server', adapter: nodejs({ mode: 'middleware' }), }); await fixture.build(); }); it('Can render locals in page', async () => { const { handler } = await import('./fixtures/locals/dist/server/entry.mjs'); let { req, res, text } = createRequestAndResponse({ method: 'POST', url: '/foo', }); let locals = { foo: 'bar' }; handler(req, res, () => {}, locals); req.send(); let html = await text(); expect(html).to.contain('