-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
28 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,32 @@ | ||
'use strict' | ||
|
||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const context = require('../helpers/context'); | ||
const assert = require('assert') | ||
const context = require('../helpers/context') | ||
|
||
describe('ctx.back([alt])', () => { | ||
it('should redirect to Referrer', () => { | ||
const ctx = context(); | ||
ctx.req.headers.referrer = '/login'; | ||
ctx.back(); | ||
assert.equal(ctx.response.header.location, '/login'); | ||
}); | ||
const ctx = context() | ||
ctx.req.headers.referrer = '/login' | ||
ctx.back() | ||
assert.equal(ctx.response.header.location, '/login') | ||
}) | ||
|
||
it('should redirect to Referer', () => { | ||
const ctx = context(); | ||
ctx.req.headers.referer = '/login'; | ||
ctx.back(); | ||
assert.equal(ctx.response.header.location, '/login'); | ||
}); | ||
const ctx = context() | ||
ctx.req.headers.referer = '/login' | ||
ctx.back() | ||
assert.equal(ctx.response.header.location, '/login') | ||
}) | ||
|
||
it('should default to alt', () => { | ||
const ctx = context(); | ||
ctx.back('/index.html'); | ||
assert.equal(ctx.response.header.location, '/index.html'); | ||
}); | ||
const ctx = context() | ||
ctx.back('/index.html') | ||
assert.equal(ctx.response.header.location, '/index.html') | ||
}) | ||
|
||
it('should default redirect to /', () => { | ||
const ctx = context(); | ||
ctx.back(); | ||
assert.equal(ctx.response.header.location, '/'); | ||
}); | ||
}); | ||
const ctx = context() | ||
ctx.back() | ||
assert.equal(ctx.response.header.location, '/') | ||
}) | ||
}) |