blob: ea8df79804c1f9589c4438b33f46f5bd9b9a13f6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import { loadFixture } from '@astrojs/test-utils';
import { expect } from 'chai';
describe('Cookies', () => {
let fixture;
before(async () => {
fixture = await loadFixture({ root: new URL('./fixtures/cookies/', import.meta.url) });
await fixture.build();
});
it('Can set multiple', async () => {
const entryURL = new URL(
'./fixtures/cookies/.netlify/functions-internal/ssr/ssr.mjs',
import.meta.url
);
const { default: handler } = await import(entryURL);
const resp = await handler(
new Request('http://example.com/login', { method: 'POST', body: '{}' }),
{}
);
expect(resp.status).to.equal(301);
expect(resp.headers.get('location')).to.equal('/');
expect(resp.headers.getSetCookie()).to.eql(['foo=foo; HttpOnly', 'bar=bar; HttpOnly']);
});
});
|