cmd-control-client-lib 3.0.14 → 3.0.18

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cmd-control-client-lib",
3
3
  "description": "Cmd-Client-Library",
4
- "version": "3.0.14",
4
+ "version": "3.0.18",
5
5
  "directories": {
6
6
  "lib": "./dist"
7
7
  },
@@ -47,7 +47,7 @@ describe("WebSocket connection", () => {
47
47
  expect(setTimeout).toHaveBeenCalledTimes(1);
48
48
  expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 15000);
49
49
 
50
- const firstError = new CustomEvent("connection-error", { detail: { reconnectionTimeout: 15000 } });
50
+ const firstError = { reConnectionTimeout: 15000 };
51
51
  expect(connectionConfig.onError).toHaveBeenCalledWith(firstError);
52
52
  jest.runOnlyPendingTimers();
53
53
  expect(logger.log).toHaveBeenCalledWith("CMDP. retry connect in 15000 ms");
@@ -58,7 +58,7 @@ describe("WebSocket connection", () => {
58
58
  CMDConnection._socket.onerror();
59
59
  CMDConnection._socket.onclose();
60
60
 
61
- const secondError = new CustomEvent("connection-error", { detail: { reconnectionTimeout: 30000 } });
61
+ const secondError = { reConnectionTimeout: 30000 };
62
62
  expect(setTimeout).toHaveBeenCalledTimes(2);
63
63
  expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 30000);
64
64
  expect(connectionConfig.onError).toHaveBeenCalledWith(secondError);
@@ -71,7 +71,7 @@ describe("WebSocket connection", () => {
71
71
  CMDConnection._socket.onerror();
72
72
  CMDConnection._socket.onclose();
73
73
 
74
- const thirdError = new CustomEvent("connection-error", { detail: { reconnectionTimeout: 45000 } });
74
+ const thirdError = { reConnectionTimeout: 45000 };
75
75
  expect(setTimeout).toHaveBeenCalledTimes(3);
76
76
  expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 45000);
77
77
  expect(connectionConfig.onError).toHaveBeenCalledWith(thirdError);
@@ -84,7 +84,7 @@ describe("WebSocket connection", () => {
84
84
  CMDConnection._socket.onerror();
85
85
  CMDConnection._socket.onclose();
86
86
 
87
- const fourthError = new CustomEvent("connection-error", { detail: { reconnectionTimeout: 60000 } });
87
+ const fourthError = { reConnectionTimeout: 60000 };
88
88
  expect(setTimeout).toHaveBeenCalledTimes(4);
89
89
  expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 60000);
90
90
  expect(connectionConfig.onError).toHaveBeenCalledWith(fourthError);
@@ -97,7 +97,7 @@ describe("WebSocket connection", () => {
97
97
  CMDConnection._socket.onerror();
98
98
  CMDConnection._socket.onclose();
99
99
 
100
- const fifthError = new CustomEvent("connection-error", { detail: { reconnectionTimeout: 75000 } });
100
+ const fifthError = { reConnectionTimeout: 75000 };
101
101
  expect(setTimeout).toHaveBeenCalledTimes(5);
102
102
  expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 75000);
103
103
  expect(connectionConfig.onError).toHaveBeenCalledWith(fifthError);
@@ -108,7 +108,7 @@ describe("WebSocket connection", () => {
108
108
  CMDConnection._socket.onerror();
109
109
  CMDConnection._socket.onclose();
110
110
 
111
- const fatalError = new CustomEvent("connection-error", { detail: { isFatal: true } });
111
+ const fatalError = { isFatal: true };
112
112
  expect(connectionConfig.onError).toHaveBeenCalledWith(fatalError);
113
113
  //No more setTimeout was called
114
114
  expect(setTimeout).toHaveBeenCalledTimes(5);