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
24 lines
609 B
JavaScript
24 lines
609 B
JavaScript
|
|
'use strict';
|
|
|
|
const Stream = require('stream');
|
|
const context = require('../helpers/context');
|
|
|
|
describe('ctx.origin', () => {
|
|
it('should return the origin of url', () => {
|
|
const socket = new Stream.Duplex();
|
|
const req = {
|
|
url: '/users/1?next=/dashboard',
|
|
headers: {
|
|
host: 'localhost'
|
|
},
|
|
socket: socket,
|
|
__proto__: Stream.Readable.prototype
|
|
};
|
|
const ctx = context(req);
|
|
ctx.origin.should.equal('http://localhost');
|
|
// change it also work
|
|
ctx.url = '/foo/users/1?next=/dashboard';
|
|
ctx.origin.should.equal('http://localhost');
|
|
});
|
|
});
|