Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit dbc9f31

Browse files
huerlisidanbucholtz
authored andcommitted
test(server): adapt server specs to new dynamic port selection (#731)
1 parent e4b311c commit dbc9f31

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/serve.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('test serve', () => {
3838
useProxy: true,
3939
notifyOnConsoleLog: false
4040
};
41-
spyOn(network, 'findClosestOpenPort').and.callFake((host: string, port: number) => Promise.resolve(port));
41+
spyOn(network, 'findClosestOpenPorts').and.callFake((host: string, ports: number[]) => Promise.resolve(ports));
4242
spyOn(notificationServer, 'createNotificationServer');
4343
spyOn(liveReloadServer, 'createLiveReloadServer');
4444
spyOn(httpServer, 'createHttpServer');
@@ -48,7 +48,7 @@ describe('test serve', () => {
4848

4949
it('should work with no args on a happy path', () => {
5050
return serve.serve(context).then(() => {
51-
expect(network.findClosestOpenPort).toHaveBeenCalledWith('0.0.0.0', 53703);
51+
expect(network.findClosestOpenPorts).toHaveBeenCalledWith('0.0.0.0', [53703, 35729, 8100]);
5252
expect(notificationServer.createNotificationServer).toHaveBeenCalledWith(configResults);
5353
expect(liveReloadServer.createLiveReloadServer).toHaveBeenCalledWith(configResults);
5454
expect(httpServer.createHttpServer).toHaveBeenCalledWith(configResults);
@@ -61,7 +61,7 @@ describe('test serve', () => {
6161
config.addArgv('android');
6262

6363
return serve.serve(context).then(() => {
64-
expect(network.findClosestOpenPort).toHaveBeenCalledWith('0.0.0.0', 53703);
64+
expect(network.findClosestOpenPorts).toHaveBeenCalledWith('0.0.0.0', [53703, 35729, 8100]);
6565
expect(notificationServer.createNotificationServer).toHaveBeenCalledWith(configResults);
6666
expect(liveReloadServer.createLiveReloadServer).toHaveBeenCalledWith(configResults);
6767
expect(httpServer.createHttpServer).toHaveBeenCalledWith(configResults);
@@ -92,14 +92,14 @@ describe('test serve', () => {
9292
configResults.host = '127.0.0.1';
9393
configResults.hostBaseUrl = 'http://127.0.0.1:8101';
9494
config.addArgv('--livereload-port');
95-
config.addArgv('35729');
96-
configResults.liveReloadPort = 35729;
95+
config.addArgv('35730');
96+
configResults.liveReloadPort = 35730;
9797
config.addArgv('--dev-logger-port');
98-
config.addArgv('53703');
99-
configResults.notificationPort = 53703;
98+
config.addArgv('53704');
99+
configResults.notificationPort = 53704;
100100

101101
return serve.serve(context).then(() => {
102-
expect(network.findClosestOpenPort).toHaveBeenCalledWith('127.0.0.1', 53703);
102+
expect(network.findClosestOpenPorts).toHaveBeenCalledWith('127.0.0.1', [53704, 35730, 8101]);
103103
expect(notificationServer.createNotificationServer).toHaveBeenCalledWith(configResults);
104104
expect(liveReloadServer.createLiveReloadServer).toHaveBeenCalledWith(configResults);
105105
expect(httpServer.createHttpServer).toHaveBeenCalledWith(configResults);

0 commit comments

Comments
 (0)