mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-11 19:04:30 +00:00
implement this.redirect in preload (#83)
This commit is contained in:
@@ -297,6 +297,33 @@ function run(env) {
|
||||
assert.ok(matches);
|
||||
});
|
||||
});
|
||||
|
||||
it('redirects on server', () => {
|
||||
return nightmare.goto(`${base}/redirect-from`)
|
||||
.path()
|
||||
.then(path => {
|
||||
assert.equal(path, '/redirect-to');
|
||||
})
|
||||
.then(() => nightmare.page.title())
|
||||
.then(title => {
|
||||
assert.equal(title, 'redirected');
|
||||
});
|
||||
});
|
||||
|
||||
it('redirects on client', () => {
|
||||
return nightmare.goto(base)
|
||||
.wait('[href="/redirect-from"]')
|
||||
.click('[href="/redirect-from"]')
|
||||
.wait(200)
|
||||
.path()
|
||||
.then(path => {
|
||||
assert.equal(path, '/redirect-to');
|
||||
})
|
||||
.then(() => nightmare.page.title())
|
||||
.then(title => {
|
||||
assert.equal(title, 'redirected');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('headers', () => {
|
||||
|
||||
Reference in New Issue
Block a user