Skip to content

Commit

Permalink
test(#zimic): verify default interceptor server options
Browse files Browse the repository at this point in the history
  • Loading branch information
diego-aquino committed Nov 10, 2024
1 parent 70f80f6 commit 4312dbe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,13 @@ describe('Interceptor server', () => {
await server.stop();
expect(server.isRunning()).toBe(false);
});

it('should use the default values for optional parameters if not provided', () => {
server = createInternalInterceptorServer();

expect(server.hostname()).toBe('localhost');
expect(server.port()).toBe(undefined);
expect(server.logUnhandledRequests()).toBe(true);
expect(server.httpURL()).toBe(undefined);
});
});
2 changes: 1 addition & 1 deletion packages/zimic/src/interceptor/server/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import { InterceptorServer as PublicInterceptorServer } from './types/public';
* @see {@link https://github.com/zimicjs/zimic/wiki/cli‐zimic‐server#zimic-server-programmatic-usage `zimic server` programmatic usage}
* @see {@link https://github.com/zimicjs/zimic/wiki/getting‐started#remote-http-interceptors Remote HTTP Interceptors} .
*/
export function createInterceptorServer(options: InterceptorServerOptions): PublicInterceptorServer {
export function createInterceptorServer(options: InterceptorServerOptions = {}): PublicInterceptorServer {
return new InterceptorServer(options);
}

0 comments on commit 4312dbe

Please sign in to comment.