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

Commit

Permalink
test(server): adapt server specs to new dynamic port selection (#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
huerlisi authored and danbucholtz committed Feb 9, 2017
1 parent e4b311c commit dbc9f31
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/serve.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('test serve', () => {
useProxy: true,
notifyOnConsoleLog: false
};
spyOn(network, 'findClosestOpenPort').and.callFake((host: string, port: number) => Promise.resolve(port));
spyOn(network, 'findClosestOpenPorts').and.callFake((host: string, ports: number[]) => Promise.resolve(ports));
spyOn(notificationServer, 'createNotificationServer');
spyOn(liveReloadServer, 'createLiveReloadServer');
spyOn(httpServer, 'createHttpServer');
Expand All @@ -48,7 +48,7 @@ describe('test serve', () => {

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

return serve.serve(context).then(() => {
expect(network.findClosestOpenPort).toHaveBeenCalledWith('0.0.0.0', 53703);
expect(network.findClosestOpenPorts).toHaveBeenCalledWith('0.0.0.0', [53703, 35729, 8100]);
expect(notificationServer.createNotificationServer).toHaveBeenCalledWith(configResults);
expect(liveReloadServer.createLiveReloadServer).toHaveBeenCalledWith(configResults);
expect(httpServer.createHttpServer).toHaveBeenCalledWith(configResults);
Expand Down Expand Up @@ -92,14 +92,14 @@ describe('test serve', () => {
configResults.host = '127.0.0.1';
configResults.hostBaseUrl = 'http://127.0.0.1:8101';
config.addArgv('--livereload-port');
config.addArgv('35729');
configResults.liveReloadPort = 35729;
config.addArgv('35730');
configResults.liveReloadPort = 35730;
config.addArgv('--dev-logger-port');
config.addArgv('53703');
configResults.notificationPort = 53703;
config.addArgv('53704');
configResults.notificationPort = 53704;

return serve.serve(context).then(() => {
expect(network.findClosestOpenPort).toHaveBeenCalledWith('127.0.0.1', 53703);
expect(network.findClosestOpenPorts).toHaveBeenCalledWith('127.0.0.1', [53704, 35730, 8101]);
expect(notificationServer.createNotificationServer).toHaveBeenCalledWith(configResults);
expect(liveReloadServer.createLiveReloadServer).toHaveBeenCalledWith(configResults);
expect(httpServer.createHttpServer).toHaveBeenCalledWith(configResults);
Expand Down

0 comments on commit dbc9f31

Please sign in to comment.