Skip to content

Commit d78b8f9

Browse files
test: more
1 parent 26cdab3 commit d78b8f9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/server/Server.test.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,42 @@ describe('Server', () => {
220220
});
221221
});
222222

223+
it('should work and using "port" from arguments and "host" from options', (done) => {
224+
const options = {
225+
host: '127.0.0.1',
226+
};
227+
228+
server = new Server(options, compiler);
229+
230+
// eslint-disable-next-line no-undefined
231+
server.listen(port, undefined, () => {
232+
const info = server.server.address();
233+
234+
expect(info.address).toBe('127.0.0.1');
235+
expect(info.port).toBe(port);
236+
237+
server.close(done);
238+
});
239+
});
240+
241+
it('should work and using "port" from options and "port" from arguments', (done) => {
242+
const options = {
243+
port,
244+
};
245+
246+
server = new Server(options, compiler);
247+
248+
// eslint-disable-next-line no-undefined
249+
server.listen(undefined, '127.0.0.1', () => {
250+
const info = server.server.address();
251+
252+
expect(info.address).toBe('127.0.0.1');
253+
expect(info.port).toBe(port);
254+
255+
server.close(done);
256+
});
257+
});
258+
223259
it('should log warning when the "port" and "host" options from options different from arguments', (done) => {
224260
const options = {
225261
host: '127.0.0.2',

0 commit comments

Comments
 (0)