Skip to content

Commit

Permalink
Rename BaseServer
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto committed Jun 6, 2024
1 parent d77bafa commit 29c88b9
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/BaseServer.ts → src/SimpleRestServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
NormalizedRequest,
} from './types.js';

export class BaseServer {
export class SimpleRestServer {
baseUrl = '';
defaultQuery: QueryFunction = () => ({});
middlewares: Array<Middleware>;
Expand Down
6 changes: 3 additions & 3 deletions src/adapters/FetchMockServer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BaseServer } from '../BaseServer.js';
import { SimpleRestServer } from '../SimpleRestServer.js';
import { parseQueryString } from '../parseQueryString.js';
import type { BaseServerOptions } from '../BaseServer.js';
import type { BaseServerOptions } from '../SimpleRestServer.js';
import type { BaseResponse, APIServer, NormalizedRequest } from '../types.js';
import type { MockResponseObject } from 'fetch-mock';

Expand All @@ -13,7 +13,7 @@ export class FetchMockServer {
server,
...options
}: FetchMockServerOptions = {}) {
this.server = server || new BaseServer(options);
this.server = server || new SimpleRestServer(options);
this.loggingEnabled = loggingEnabled;
}

Expand Down
6 changes: 3 additions & 3 deletions src/adapters/MswServer.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { http, HttpResponse } from 'msw';
import { BaseServer } from '../BaseServer.js';
import type { BaseServerOptions } from '../BaseServer.js';
import { SimpleRestServer } from '../SimpleRestServer.js';
import type { BaseServerOptions } from '../SimpleRestServer.js';
import type { APIServer, NormalizedRequest } from '../types.js';

export class MswServer {
server: APIServer;

constructor({ server, ...options }: MswServerOptions) {
this.server = server || new BaseServer(options);
this.server = server || new SimpleRestServer(options);
}

getHandler() {
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/SinonServer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sinon, { type SinonFakeXMLHttpRequest } from 'sinon';
import { SinonServer } from './SinonServer.js';
import { Single } from '../Single.js';
import { Collection } from '../Collection.js';
import type { BaseResponse } from '../BaseServer.js';
import type { BaseResponse } from '../SimpleRestServer.js';

function getFakeXMLHTTPRequest(
method: string,
Expand Down
7 changes: 5 additions & 2 deletions src/adapters/SinonServer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { SinonFakeXMLHttpRequest } from 'sinon';
import { BaseServer, type BaseServerOptions } from '../BaseServer.js';
import {
SimpleRestServer,
type BaseServerOptions,
} from '../SimpleRestServer.js';
import { parseQueryString } from '../parseQueryString.js';
import type { BaseResponse, APIServer, NormalizedRequest } from '../types.js';

Expand All @@ -12,7 +15,7 @@ export class SinonServer {
server,
...options
}: SinonServerOptions = {}) {
this.server = server || new BaseServer(options);
this.server = server || new SimpleRestServer(options);
this.loggingEnabled = loggingEnabled;
}

Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import {
} from './adapters/FetchMockServer.js';
import { getMswHandler, MswServer } from './adapters/MswServer.js';
import { Database } from './Database.js';
import { BaseServer } from './BaseServer.js';
import { SimpleRestServer } from './SimpleRestServer.js';
import { Collection } from './Collection.js';
import { Single } from './Single.js';
import { withDelay } from './withDelay.js';

export {
BaseServer,
SimpleRestServer,
Database,
getSinonHandler,
getFetchMockHandler,
Expand All @@ -32,7 +32,7 @@ export {
};

export default {
BaseServer,
SimpleRestServer,
Database,
getSinonHandler,
getFetchMockHandler,
Expand Down
2 changes: 1 addition & 1 deletion src/withDelay.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Middleware } from './BaseServer.js';
import type { Middleware } from './SimpleRestServer.js';

export const withDelay =
(delayMs: number): Middleware =>
Expand Down

0 comments on commit 29c88b9

Please sign in to comment.