|
1 | 1 | import { createClientInitializationCheck } from './checks'; |
2 | 2 |
|
3 | 3 | describe('createClientInitializationCheck', () => { |
4 | | - it('should return SUCCESS for a valid initialize request', () => { |
5 | | - const validRequest = { |
6 | | - protocolVersion: '2025-06-18', |
7 | | - clientInfo: { |
8 | | - name: 'TestClient', |
9 | | - version: '1.0.0' |
10 | | - } |
11 | | - }; |
| 4 | + it('should return SUCCESS for a valid initialize request', () => { |
| 5 | + const validRequest = { |
| 6 | + protocolVersion: '2025-06-18', |
| 7 | + clientInfo: { |
| 8 | + name: 'TestClient', |
| 9 | + version: '1.0.0' |
| 10 | + } |
| 11 | + }; |
12 | 12 |
|
13 | | - const check = createClientInitializationCheck(validRequest); |
14 | | - expect(check.status).toBe('SUCCESS'); |
15 | | - expect(check.errorMessage).toBeUndefined(); |
16 | | - }); |
| 13 | + const check = createClientInitializationCheck(validRequest); |
| 14 | + expect(check.status).toBe('SUCCESS'); |
| 15 | + expect(check.errorMessage).toBeUndefined(); |
| 16 | + }); |
17 | 17 |
|
18 | | - it('should return FAILURE when protocol version is missing', () => { |
19 | | - const invalidRequest = { |
20 | | - clientInfo: { |
21 | | - name: 'TestClient', |
22 | | - version: '1.0.0' |
23 | | - } |
24 | | - }; |
| 18 | + it('should return FAILURE when protocol version is missing', () => { |
| 19 | + const invalidRequest = { |
| 20 | + clientInfo: { |
| 21 | + name: 'TestClient', |
| 22 | + version: '1.0.0' |
| 23 | + } |
| 24 | + }; |
25 | 25 |
|
26 | | - const check = createClientInitializationCheck(invalidRequest); |
27 | | - expect(check.status).toBe('FAILURE'); |
28 | | - expect(check.errorMessage).toContain('Protocol version not provided'); |
29 | | - }); |
| 26 | + const check = createClientInitializationCheck(invalidRequest); |
| 27 | + expect(check.status).toBe('FAILURE'); |
| 28 | + expect(check.errorMessage).toContain('Protocol version not provided'); |
| 29 | + }); |
30 | 30 |
|
31 | | - it('should return FAILURE when protocol version does not match', () => { |
32 | | - const invalidRequest = { |
33 | | - protocolVersion: '2024-11-05', |
34 | | - clientInfo: { |
35 | | - name: 'TestClient', |
36 | | - version: '1.0.0' |
37 | | - } |
38 | | - }; |
| 31 | + it('should return FAILURE when protocol version does not match', () => { |
| 32 | + const invalidRequest = { |
| 33 | + protocolVersion: '2024-11-05', |
| 34 | + clientInfo: { |
| 35 | + name: 'TestClient', |
| 36 | + version: '1.0.0' |
| 37 | + } |
| 38 | + }; |
39 | 39 |
|
40 | | - const check = createClientInitializationCheck(invalidRequest); |
41 | | - expect(check.status).toBe('FAILURE'); |
42 | | - expect(check.errorMessage).toContain('Version mismatch'); |
43 | | - }); |
| 40 | + const check = createClientInitializationCheck(invalidRequest); |
| 41 | + expect(check.status).toBe('FAILURE'); |
| 42 | + expect(check.errorMessage).toContain('Version mismatch'); |
| 43 | + }); |
44 | 44 |
|
45 | | - it('should return FAILURE when client name is missing', () => { |
46 | | - const invalidRequest = { |
47 | | - protocolVersion: '2025-06-18', |
48 | | - clientInfo: { |
49 | | - version: '1.0.0' |
50 | | - } |
51 | | - }; |
| 45 | + it('should return FAILURE when client name is missing', () => { |
| 46 | + const invalidRequest = { |
| 47 | + protocolVersion: '2025-06-18', |
| 48 | + clientInfo: { |
| 49 | + version: '1.0.0' |
| 50 | + } |
| 51 | + }; |
52 | 52 |
|
53 | | - const check = createClientInitializationCheck(invalidRequest); |
54 | | - expect(check.status).toBe('FAILURE'); |
55 | | - expect(check.errorMessage).toContain('Client name missing'); |
56 | | - }); |
| 53 | + const check = createClientInitializationCheck(invalidRequest); |
| 54 | + expect(check.status).toBe('FAILURE'); |
| 55 | + expect(check.errorMessage).toContain('Client name missing'); |
| 56 | + }); |
57 | 57 |
|
58 | | - it('should return FAILURE when client version is missing', () => { |
59 | | - const invalidRequest = { |
60 | | - protocolVersion: '2025-06-18', |
61 | | - clientInfo: { |
62 | | - name: 'TestClient' |
63 | | - } |
64 | | - }; |
| 58 | + it('should return FAILURE when client version is missing', () => { |
| 59 | + const invalidRequest = { |
| 60 | + protocolVersion: '2025-06-18', |
| 61 | + clientInfo: { |
| 62 | + name: 'TestClient' |
| 63 | + } |
| 64 | + }; |
65 | 65 |
|
66 | | - const check = createClientInitializationCheck(invalidRequest); |
67 | | - expect(check.status).toBe('FAILURE'); |
68 | | - expect(check.errorMessage).toContain('Client version missing'); |
69 | | - }); |
| 66 | + const check = createClientInitializationCheck(invalidRequest); |
| 67 | + expect(check.status).toBe('FAILURE'); |
| 68 | + expect(check.errorMessage).toContain('Client version missing'); |
| 69 | + }); |
70 | 70 |
|
71 | | - it('should support custom expected spec version', () => { |
72 | | - const request = { |
73 | | - protocolVersion: '2024-11-05', |
74 | | - clientInfo: { |
75 | | - name: 'TestClient', |
76 | | - version: '1.0.0' |
77 | | - } |
78 | | - }; |
| 71 | + it('should support custom expected spec version', () => { |
| 72 | + const request = { |
| 73 | + protocolVersion: '2024-11-05', |
| 74 | + clientInfo: { |
| 75 | + name: 'TestClient', |
| 76 | + version: '1.0.0' |
| 77 | + } |
| 78 | + }; |
79 | 79 |
|
80 | | - const check = createClientInitializationCheck(request, '2024-11-05'); |
81 | | - expect(check.status).toBe('SUCCESS'); |
82 | | - expect(check.errorMessage).toBeUndefined(); |
83 | | - }); |
| 80 | + const check = createClientInitializationCheck(request, '2024-11-05'); |
| 81 | + expect(check.status).toBe('SUCCESS'); |
| 82 | + expect(check.errorMessage).toBeUndefined(); |
| 83 | + }); |
84 | 84 | }); |
0 commit comments