@labdigital/commercetools-mock 2.43.1 → 2.43.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/ctMock.ts +7 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as msw from 'msw';
|
|
1
2
|
import express from 'express';
|
|
2
3
|
import { SetupServerApi, SetupServer } from 'msw/node';
|
|
3
4
|
import * as ctp from '@commercetools/platform-sdk';
|
|
@@ -619,6 +620,7 @@ declare class CommercetoolsMock {
|
|
|
619
620
|
runServer(port?: number, options?: AppOptions): void;
|
|
620
621
|
private createApp;
|
|
621
622
|
registerHandlers(server: SetupServerApi): void;
|
|
623
|
+
getHandlers(): msw.HttpHandler[];
|
|
622
624
|
mswServer(): SetupServer | undefined;
|
|
623
625
|
private startServer;
|
|
624
626
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as msw from 'msw';
|
|
1
2
|
import express from 'express';
|
|
2
3
|
import { SetupServerApi, SetupServer } from 'msw/node';
|
|
3
4
|
import * as ctp from '@commercetools/platform-sdk';
|
|
@@ -619,6 +620,7 @@ declare class CommercetoolsMock {
|
|
|
619
620
|
runServer(port?: number, options?: AppOptions): void;
|
|
620
621
|
private createApp;
|
|
621
622
|
registerHandlers(server: SetupServerApi): void;
|
|
623
|
+
getHandlers(): msw.HttpHandler[];
|
|
622
624
|
mswServer(): SetupServer | undefined;
|
|
623
625
|
private startServer;
|
|
624
626
|
}
|
package/dist/index.js
CHANGED
|
@@ -9330,8 +9330,12 @@ var CommercetoolsMock = class {
|
|
|
9330
9330
|
// allows you to manage msw server yourself and register the handlers needed
|
|
9331
9331
|
// for commercetools-mock to work.
|
|
9332
9332
|
registerHandlers(server) {
|
|
9333
|
+
const handlers = this.getHandlers();
|
|
9334
|
+
server.use(...handlers);
|
|
9335
|
+
}
|
|
9336
|
+
getHandlers() {
|
|
9333
9337
|
const app = this.app;
|
|
9334
|
-
|
|
9338
|
+
return [
|
|
9335
9339
|
http.post(`${this.options.authHost}/oauth/*`, async ({ request }) => {
|
|
9336
9340
|
const body = await request.text();
|
|
9337
9341
|
const url = new URL(request.url);
|
|
@@ -9390,7 +9394,7 @@ var CommercetoolsMock = class {
|
|
|
9390
9394
|
headers: mapHeaderType(res.headers)
|
|
9391
9395
|
});
|
|
9392
9396
|
})
|
|
9393
|
-
|
|
9397
|
+
];
|
|
9394
9398
|
}
|
|
9395
9399
|
mswServer() {
|
|
9396
9400
|
return this._mswServer;
|