UNPKG

lazo-next

Version:

A client-server web framework built on Node.js that allows front-end developers to easily create a 100% SEO compliant, component MVC structured web application with an optimized first page load.

69 lines (63 loc) 2.1 kB
define([ 'intern!bdd', 'intern/chai!', 'intern/chai!expect', 'sinon', 'sinon-chai', 'test/unit/utils', 'context' ], function (bdd, chai, expect, sinon, sinonChai, utils, Context) { chai.use(sinonChai); with (bdd) { describe('Context', function () { it('common server', function () { var ctx = new Context({ _request: { url: { pathname: 'foo/bar/baz' }, raw: { // this is expected on the server req: { headers: { host: 'localhost:8080' } } }, server: { info: { protocol: 'http' } } }, headers: { host: 'localhost:8080' } }); expect(ctx.location.pathname).to.be.equal('foo/bar/baz'); }); it('handles undefined host', function () { var ctx = new Context({ _request: { url: { pathname: 'foo/bar/baz' }, raw: { // this is expected on the server req: { headers: { host: 'localhost:8080' } } }, server: { info: { protocol: 'http' } } }, headers: {} }); expect(ctx.location.host).to.be.undefined; }); }); } });