astro/test/astro-request.test.js
Matthew Phillips 41c64b30af
Move the request object from import.meta to Astro (#134)
* Move the `request` object from import.meta to Astro

This moves the `request` object to the Astro "global" (really just a render-level variable).

* Document Astro.request
2021-04-27 14:00:33 -04:00

19 lines
470 B
JavaScript

import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { doc } from './test-utils.js';
import { setup } from './helpers.js';
const Request = suite('Astro.request');
setup(Request, './fixtures/astro-request');
Request('Astro.request available', async (context) => {
const result = await context.runtime.load('/');
assert.equal(result.statusCode, 200);
const $ = doc(result.contents);
assert.equal($('h1').text(), '/');
});
Request.run();