mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-11 19:04:30 +00:00
implement this.fetch (#178)
This commit is contained in:
@@ -533,6 +533,32 @@ function run({ mode, basepath = '' }) {
|
||||
assert.equal(title, 'Stored title');
|
||||
});
|
||||
});
|
||||
|
||||
it('sends cookies when using this.fetch with credentials: "include"', () => {
|
||||
return nightmare.goto(`${base}/credentials?creds=include`)
|
||||
.page.title()
|
||||
.then(title => {
|
||||
assert.equal(title, 'woohoo!');
|
||||
});
|
||||
});
|
||||
|
||||
it('does not send cookies when using this.fetch without credentials', () => {
|
||||
return nightmare.goto(`${base}/credentials`)
|
||||
.page.title()
|
||||
.then(title => {
|
||||
assert.equal(title, 'unauthorized');
|
||||
});
|
||||
});
|
||||
|
||||
it('delegates to fetch on the client', () => {
|
||||
return nightmare.goto(base).init()
|
||||
.click('[href="credentials?creds=include"]')
|
||||
.wait(100)
|
||||
.page.title()
|
||||
.then(title => {
|
||||
assert.equal(title, 'woohoo!');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('headers', () => {
|
||||
|
||||
Reference in New Issue
Block a user