4b1a1da652
closes #553 Update test: application -> use() should throw if not a function Fix lint Use arrow function Refactor test using arrow function Remove non mandatory brackets fix for merge Fix: missing refactor after merge Use arrow function for old generator
31 lines
782 B
JavaScript
31 lines
782 B
JavaScript
|
|
'use strict';
|
|
|
|
const context = require('../helpers/context');
|
|
|
|
describe('ctx.path', () => {
|
|
it('should return the pathname', () => {
|
|
const ctx = context();
|
|
ctx.url = '/login?next=/dashboard';
|
|
ctx.path.should.equal('/login');
|
|
});
|
|
});
|
|
|
|
describe('ctx.path=', () => {
|
|
it('should set the pathname', () => {
|
|
const ctx = context();
|
|
ctx.url = '/login?next=/dashboard';
|
|
|
|
ctx.path = '/logout';
|
|
ctx.path.should.equal('/logout');
|
|
ctx.url.should.equal('/logout?next=/dashboard');
|
|
});
|
|
|
|
it('should change .url but not .originalUrl', () => {
|
|
const ctx = context({ url: '/login' });
|
|
ctx.path = '/logout';
|
|
ctx.url.should.equal('/logout');
|
|
ctx.originalUrl.should.equal('/login');
|
|
ctx.request.originalUrl.should.equal('/login');
|
|
});
|
|
});
|