mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
6fd161d769
* Start of work on astroConfig.mode === 'server' * Add tests and more * adapter -> deploy in some places * Add fallback for `adapter` config * Update more tests * Update image tests * Fix clientAddress test * Updates based on PR review * Add a changeset * Update integrations tests + readme * Oops * Remove old option * Rename `mode` to `output` * Update Node adapter test * Update test * fred pass * fred pass * fred pass * fix test Co-authored-by: Fred K. Schott <fkschott@gmail.com>
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import { expect } from 'chai';
|
|
import { load as cheerioLoad } from 'cheerio';
|
|
import { loadFixture, testIntegration } from './test-utils.js';
|
|
import netlifyAdapter from '../../dist/index.js';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
describe('Cookies', () => {
|
|
/** @type {import('../../../astro/test/test-utils').Fixture} */
|
|
let fixture;
|
|
|
|
before(async () => {
|
|
fixture = await loadFixture({
|
|
root: new URL('./fixtures/cookies/', import.meta.url).toString(),
|
|
output: 'server',
|
|
adapter: netlifyAdapter({
|
|
dist: new URL('./fixtures/cookies/dist/', import.meta.url),
|
|
}),
|
|
site: `http://example.com`,
|
|
integrations: [testIntegration()],
|
|
});
|
|
await fixture.build();
|
|
});
|
|
|
|
it('Can set multiple', async () => {
|
|
const entryURL = new URL(
|
|
'./fixtures/cookies/.netlify/functions-internal/entry.mjs',
|
|
import.meta.url
|
|
);
|
|
const { handler } = await import(entryURL);
|
|
const resp = await handler({
|
|
httpMethod: 'POST',
|
|
headers: {},
|
|
rawUrl: 'http://example.com/login',
|
|
body: '{}',
|
|
isBase64Encoded: false,
|
|
});
|
|
expect(resp.statusCode).to.equal(301);
|
|
expect(resp.headers.location).to.equal('/');
|
|
expect(resp.multiValueHeaders).to.be.deep.equal({
|
|
'set-cookie': ['foo=foo; HttpOnly', 'bar=bar; HttpOnly'],
|
|
});
|
|
});
|
|
});
|