@webitel/ui-sdk 23.12.30 → 23.12.31
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
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import websocketValidator from '../websocketValidator';
|
|
2
|
+
|
|
3
|
+
describe('websocketValidator', () => {
|
|
4
|
+
it('truthy case 1: localhost ws', () => {
|
|
5
|
+
expect(websocketValidator('ws://localhost:8080')).toBe(true);
|
|
6
|
+
});
|
|
7
|
+
it('truthy case 2: localhost wss', () => {
|
|
8
|
+
expect(websocketValidator('wss://localhost:8080')).toBe(true);
|
|
9
|
+
});
|
|
10
|
+
it('truthy case 3: ip ws', () => {
|
|
11
|
+
expect(websocketValidator('ws://10.10.10.10:8080')).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
it('truthy case 4: dns name', () => {
|
|
14
|
+
expect(websocketValidator('wss://example.com')).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
it('truthy case 5: dns name', () => {
|
|
17
|
+
expect(websocketValidator('wss://example.com/ws')).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
it('truthy case 6: dns name', () => {
|
|
20
|
+
expect(websocketValidator('wss://socket.socket.com/v3/channel_123?api_key=123')).toBe(true);
|
|
21
|
+
});
|
|
22
|
+
it('falsy case 1: empty string', () => {
|
|
23
|
+
expect(websocketValidator('')).toBe(false);
|
|
24
|
+
});
|
|
25
|
+
it('falsy case 2: ws+ws', () => {
|
|
26
|
+
expect(websocketValidator('wss://example.com/wswss://example.com/ws')).toBe(false);
|
|
27
|
+
});
|
|
28
|
+
});
|