-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
1 changed file
with
61 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const request = require('supertest'); | ||
const config = require('./fixtures/simple-config/webpack.config'); | ||
const helper = require('./helper'); | ||
|
||
describe('socket options', () => { | ||
let server; | ||
let req; | ||
|
||
afterEach(helper.close); | ||
|
||
describe('default behavior', () => { | ||
const defaultPath = '/sockjs-node'; | ||
before((done) => { | ||
server = helper.start(config, {}, done); | ||
req = request(server.app); | ||
}); | ||
|
||
it('defaults to a path', () => { | ||
assert.equal(server.sockPath, defaultPath); | ||
}); | ||
|
||
it('responds', (done) => { | ||
req.get(defaultPath) | ||
.expect(200) | ||
.end((err) => { | ||
if (err) { | ||
done(err); | ||
} | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('socksPath option', () => { | ||
const path = '/foo/test/bar'; | ||
before((done) => { | ||
server = helper.start(config, { | ||
sockPath: '/foo/test/bar/' | ||
}, done); | ||
req = request(server.app); | ||
}); | ||
|
||
it('correctly sets the servers sockPath including removal of extraneous slashes', () => { | ||
assert.equal(path, server.sockPath); | ||
}); | ||
|
||
it('responds', (done) => { | ||
req.get(path) | ||
.expect(200) | ||
.end((err) => { | ||
if (err) { | ||
done(err); | ||
} | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |