-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathpreview-sdk-service.ts
37 lines (29 loc) · 1.23 KB
/
preview-sdk-service.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { PreviewSdkService } from "../../lib/services/livesync/playground/preview-sdk-service";
import { Yok } from "../../lib/common/yok";
import { assert } from "chai";
import { LoggerStub } from "../stubs";
const getPreviewSdkService = (): IPreviewSdkService => {
const testInjector = new Yok();
testInjector.register("logger", LoggerStub);
testInjector.register("config", {});
testInjector.register("previewSdkService", PreviewSdkService);
testInjector.register("previewDevicesService", {});
testInjector.register("httpClient", {
httpRequest: async (options: any, proxySettings?: IProxySettings): Promise<Server.IResponse> => undefined
});
return testInjector.resolve("previewSdkService");
};
describe('PreviewSdkService', () => {
describe('getQrCodeUrl', () => {
it('sets hmr to 1 when useHotModuleReload is true', async () => {
const sdk = getPreviewSdkService();
const previewUrl = sdk.getQrCodeUrl({ useHotModuleReload: true });
assert.isTrue(previewUrl.indexOf("hmr=1") > -1);
});
});
it('sets hmr to 0 when useHotModuleReload is false', async () => {
const sdk = getPreviewSdkService();
const previewUrl = sdk.getQrCodeUrl({ useHotModuleReload: false });
assert.isTrue(previewUrl.indexOf("hmr=0") > -1);
});
});