@app-connect/core 0.0.3 → 1.6.4
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/.env.test +5 -5
- package/README.md +434 -425
- package/adapter/mock.js +76 -76
- package/adapter/registry.js +247 -247
- package/handlers/admin.js +62 -60
- package/handlers/auth.js +205 -156
- package/handlers/contact.js +274 -274
- package/handlers/disposition.js +193 -193
- package/handlers/log.js +612 -586
- package/handlers/user.js +101 -101
- package/index.js +1302 -1202
- package/jest.config.js +56 -56
- package/lib/analytics.js +52 -52
- package/lib/callLogComposer.js +550 -451
- package/lib/constants.js +9 -0
- package/lib/encode.js +30 -30
- package/lib/generalErrorMessage.js +41 -41
- package/lib/jwt.js +16 -16
- package/lib/oauth.js +79 -29
- package/lib/util.js +43 -40
- package/models/adminConfigModel.js +17 -17
- package/models/cacheModel.js +23 -23
- package/models/callLogModel.js +27 -27
- package/models/dynamo/lockSchema.js +24 -24
- package/models/dynamo/noteCacheSchema.js +30 -0
- package/models/messageLogModel.js +25 -25
- package/models/sequelize.js +16 -16
- package/models/userModel.js +38 -38
- package/package.json +67 -64
- package/releaseNotes.json +701 -577
- package/test/adapter/registry.test.js +270 -270
- package/test/handlers/auth.test.js +230 -230
- package/test/lib/jwt.test.js +161 -161
- package/test/setup.js +176 -176
|
@@ -1,231 +1,231 @@
|
|
|
1
|
-
const authHandler = require('../../handlers/auth');
|
|
2
|
-
const adapterRegistry = require('../../adapter/registry');
|
|
3
|
-
|
|
4
|
-
// Mock the adapter registry
|
|
5
|
-
jest.mock('../../adapter/registry');
|
|
6
|
-
|
|
7
|
-
describe('Auth Handler', () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
// Reset mocks
|
|
10
|
-
jest.clearAllMocks();
|
|
11
|
-
global.testUtils.resetAdapterRegistry();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
describe('onApiKeyLogin', () => {
|
|
15
|
-
test('should handle successful API key login', async () => {
|
|
16
|
-
// Arrange
|
|
17
|
-
const mockUserInfo = {
|
|
18
|
-
successful: true,
|
|
19
|
-
platformUserInfo: {
|
|
20
|
-
id: 'test-user-id',
|
|
21
|
-
name: 'Test User',
|
|
22
|
-
timezoneName: 'America/Los_Angeles',
|
|
23
|
-
timezoneOffset: 0,
|
|
24
|
-
platformAdditionalInfo: {}
|
|
25
|
-
},
|
|
26
|
-
returnMessage: {
|
|
27
|
-
messageType: 'success',
|
|
28
|
-
message: 'Login successful',
|
|
29
|
-
ttl: 1000
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const mockAdapter = global.testUtils.createMockAdapter({
|
|
34
|
-
getBasicAuth: jest.fn().mockReturnValue('dGVzdC1hcGkta2V5Og=='),
|
|
35
|
-
getUserInfo: jest.fn().mockResolvedValue(mockUserInfo)
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
adapterRegistry.getAdapter.mockReturnValue(mockAdapter);
|
|
39
|
-
|
|
40
|
-
const requestData = {
|
|
41
|
-
platform: 'testCRM',
|
|
42
|
-
hostname: 'test.example.com',
|
|
43
|
-
apiKey: 'test-api-key',
|
|
44
|
-
additionalInfo: {}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// Act
|
|
48
|
-
const result = await authHandler.onApiKeyLogin(requestData);
|
|
49
|
-
|
|
50
|
-
// Assert
|
|
51
|
-
expect(result.userInfo).toBeDefined();
|
|
52
|
-
expect(result.userInfo.id).toBe('test-user-id');
|
|
53
|
-
expect(result.userInfo.name).toBe('Test User');
|
|
54
|
-
expect(result.returnMessage).toEqual(mockUserInfo.returnMessage);
|
|
55
|
-
expect(mockAdapter.getBasicAuth).toHaveBeenCalledWith({ apiKey: 'test-api-key' });
|
|
56
|
-
expect(mockAdapter.getUserInfo).toHaveBeenCalledWith({
|
|
57
|
-
authHeader: 'Basic dGVzdC1hcGkta2V5Og==',
|
|
58
|
-
hostname: 'test.example.com',
|
|
59
|
-
additionalInfo: {},
|
|
60
|
-
apiKey: 'test-api-key'
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
test('should handle failed API key login', async () => {
|
|
65
|
-
// Arrange
|
|
66
|
-
const mockUserInfo = {
|
|
67
|
-
successful: false,
|
|
68
|
-
platformUserInfo: null,
|
|
69
|
-
returnMessage: {
|
|
70
|
-
messageType: 'error',
|
|
71
|
-
message: 'Invalid API key',
|
|
72
|
-
ttl: 3000
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const mockAdapter = global.testUtils.createMockAdapter({
|
|
77
|
-
getBasicAuth: jest.fn().mockReturnValue('dGVzdC1hcGkta2V5Og=='),
|
|
78
|
-
getUserInfo: jest.fn().mockResolvedValue(mockUserInfo)
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
adapterRegistry.getAdapter.mockReturnValue(mockAdapter);
|
|
82
|
-
|
|
83
|
-
const requestData = {
|
|
84
|
-
platform: 'testCRM',
|
|
85
|
-
hostname: 'test.example.com',
|
|
86
|
-
apiKey: 'invalid-api-key',
|
|
87
|
-
additionalInfo: {}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// Act
|
|
91
|
-
const result = await authHandler.onApiKeyLogin(requestData);
|
|
92
|
-
|
|
93
|
-
// Assert
|
|
94
|
-
expect(result.userInfo).toBeNull();
|
|
95
|
-
expect(result.returnMessage).toEqual(mockUserInfo.returnMessage);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
test('should throw error when adapter not found', async () => {
|
|
99
|
-
// Arrange
|
|
100
|
-
adapterRegistry.getAdapter.mockImplementation(() => {
|
|
101
|
-
throw new Error('Adapter not found for platform: testCRM');
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
const requestData = {
|
|
105
|
-
platform: 'testCRM',
|
|
106
|
-
hostname: 'test.example.com',
|
|
107
|
-
apiKey: 'test-api-key',
|
|
108
|
-
additionalInfo: {}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// Act & Assert
|
|
112
|
-
await expect(authHandler.onApiKeyLogin(requestData))
|
|
113
|
-
.rejects.toThrow('Adapter not found for platform: testCRM');
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
describe('authValidation', () => {
|
|
118
|
-
test('should validate user authentication successfully', async () => {
|
|
119
|
-
// Arrange
|
|
120
|
-
const mockUser = global.testUtils.createMockUser();
|
|
121
|
-
const mockValidationResponse = {
|
|
122
|
-
successful: true,
|
|
123
|
-
returnMessage: {
|
|
124
|
-
messageType: 'success',
|
|
125
|
-
message: 'Authentication valid',
|
|
126
|
-
ttl: 1000
|
|
127
|
-
},
|
|
128
|
-
status: 200
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const mockAdapter = global.testUtils.createMockAdapter({
|
|
132
|
-
getOauthInfo: jest.fn().mockResolvedValue({}),
|
|
133
|
-
authValidation: jest.fn().mockResolvedValue(mockValidationResponse)
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
adapterRegistry.getAdapter.mockReturnValue(mockAdapter);
|
|
137
|
-
|
|
138
|
-
// Mock UserModel.findOne to return a user
|
|
139
|
-
const { UserModel } = require('../../models/userModel');
|
|
140
|
-
jest.spyOn(UserModel, 'findOne').mockResolvedValue(mockUser);
|
|
141
|
-
|
|
142
|
-
// Mock oauth.checkAndRefreshAccessToken
|
|
143
|
-
const oauth = require('../../lib/oauth');
|
|
144
|
-
jest.spyOn(oauth, 'checkAndRefreshAccessToken').mockResolvedValue(mockUser);
|
|
145
|
-
|
|
146
|
-
const requestData = {
|
|
147
|
-
platform: 'testCRM',
|
|
148
|
-
userId: 'test-user-id'
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
// Act
|
|
152
|
-
const result = await authHandler.authValidation(requestData);
|
|
153
|
-
|
|
154
|
-
// Assert
|
|
155
|
-
expect(result).toEqual({
|
|
156
|
-
...mockValidationResponse,
|
|
157
|
-
failReason: ''
|
|
158
|
-
});
|
|
159
|
-
expect(mockAdapter.authValidation).toHaveBeenCalledWith({ user: mockUser });
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
test('should handle user not found in database', async () => {
|
|
163
|
-
// Arrange
|
|
164
|
-
const mockAdapter = global.testUtils.createMockAdapter();
|
|
165
|
-
adapterRegistry.getAdapter.mockReturnValue(mockAdapter);
|
|
166
|
-
|
|
167
|
-
// Mock UserModel.findOne to return null (user not found)
|
|
168
|
-
const { UserModel } = require('../../models/userModel');
|
|
169
|
-
jest.spyOn(UserModel, 'findOne').mockResolvedValue(null);
|
|
170
|
-
|
|
171
|
-
const requestData = {
|
|
172
|
-
platform: 'testCRM',
|
|
173
|
-
userId: 'non-existent-user'
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
// Act
|
|
177
|
-
const result = await authHandler.authValidation(requestData);
|
|
178
|
-
|
|
179
|
-
// Assert
|
|
180
|
-
expect(result).toEqual({
|
|
181
|
-
successful: false,
|
|
182
|
-
status: 404,
|
|
183
|
-
failReason: 'App Connect. User not found in database'
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
test('should handle validation failure', async () => {
|
|
188
|
-
// Arrange
|
|
189
|
-
const mockUser = global.testUtils.createMockUser();
|
|
190
|
-
const mockValidationResponse = {
|
|
191
|
-
successful: false,
|
|
192
|
-
returnMessage: {
|
|
193
|
-
messageType: 'error',
|
|
194
|
-
message: 'Authentication failed',
|
|
195
|
-
ttl: 3000
|
|
196
|
-
},
|
|
197
|
-
status: 401
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
const mockAdapter = global.testUtils.createMockAdapter({
|
|
201
|
-
getOauthInfo: jest.fn().mockResolvedValue({}),
|
|
202
|
-
authValidation: jest.fn().mockResolvedValue(mockValidationResponse)
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
adapterRegistry.getAdapter.mockReturnValue(mockAdapter);
|
|
206
|
-
|
|
207
|
-
// Mock UserModel.findOne to return a user
|
|
208
|
-
const { UserModel } = require('../../models/userModel');
|
|
209
|
-
jest.spyOn(UserModel, 'findOne').mockResolvedValue(mockUser);
|
|
210
|
-
|
|
211
|
-
// Mock oauth.checkAndRefreshAccessToken
|
|
212
|
-
const oauth = require('../../lib/oauth');
|
|
213
|
-
jest.spyOn(oauth, 'checkAndRefreshAccessToken').mockResolvedValue(mockUser);
|
|
214
|
-
|
|
215
|
-
const requestData = {
|
|
216
|
-
platform: 'testCRM',
|
|
217
|
-
userId: 'test-user-id'
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
// Act
|
|
221
|
-
const result = await authHandler.authValidation(requestData);
|
|
222
|
-
|
|
223
|
-
// Assert
|
|
224
|
-
expect(result).toEqual({
|
|
225
|
-
...mockValidationResponse,
|
|
226
|
-
failReason: 'CRM. API failed'
|
|
227
|
-
});
|
|
228
|
-
expect(result.successful).toBe(false);
|
|
229
|
-
});
|
|
230
|
-
});
|
|
1
|
+
const authHandler = require('../../handlers/auth');
|
|
2
|
+
const adapterRegistry = require('../../adapter/registry');
|
|
3
|
+
|
|
4
|
+
// Mock the adapter registry
|
|
5
|
+
jest.mock('../../adapter/registry');
|
|
6
|
+
|
|
7
|
+
describe('Auth Handler', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
// Reset mocks
|
|
10
|
+
jest.clearAllMocks();
|
|
11
|
+
global.testUtils.resetAdapterRegistry();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe('onApiKeyLogin', () => {
|
|
15
|
+
test('should handle successful API key login', async () => {
|
|
16
|
+
// Arrange
|
|
17
|
+
const mockUserInfo = {
|
|
18
|
+
successful: true,
|
|
19
|
+
platformUserInfo: {
|
|
20
|
+
id: 'test-user-id',
|
|
21
|
+
name: 'Test User',
|
|
22
|
+
timezoneName: 'America/Los_Angeles',
|
|
23
|
+
timezoneOffset: 0,
|
|
24
|
+
platformAdditionalInfo: {}
|
|
25
|
+
},
|
|
26
|
+
returnMessage: {
|
|
27
|
+
messageType: 'success',
|
|
28
|
+
message: 'Login successful',
|
|
29
|
+
ttl: 1000
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const mockAdapter = global.testUtils.createMockAdapter({
|
|
34
|
+
getBasicAuth: jest.fn().mockReturnValue('dGVzdC1hcGkta2V5Og=='),
|
|
35
|
+
getUserInfo: jest.fn().mockResolvedValue(mockUserInfo)
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
adapterRegistry.getAdapter.mockReturnValue(mockAdapter);
|
|
39
|
+
|
|
40
|
+
const requestData = {
|
|
41
|
+
platform: 'testCRM',
|
|
42
|
+
hostname: 'test.example.com',
|
|
43
|
+
apiKey: 'test-api-key',
|
|
44
|
+
additionalInfo: {}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Act
|
|
48
|
+
const result = await authHandler.onApiKeyLogin(requestData);
|
|
49
|
+
|
|
50
|
+
// Assert
|
|
51
|
+
expect(result.userInfo).toBeDefined();
|
|
52
|
+
expect(result.userInfo.id).toBe('test-user-id');
|
|
53
|
+
expect(result.userInfo.name).toBe('Test User');
|
|
54
|
+
expect(result.returnMessage).toEqual(mockUserInfo.returnMessage);
|
|
55
|
+
expect(mockAdapter.getBasicAuth).toHaveBeenCalledWith({ apiKey: 'test-api-key' });
|
|
56
|
+
expect(mockAdapter.getUserInfo).toHaveBeenCalledWith({
|
|
57
|
+
authHeader: 'Basic dGVzdC1hcGkta2V5Og==',
|
|
58
|
+
hostname: 'test.example.com',
|
|
59
|
+
additionalInfo: {},
|
|
60
|
+
apiKey: 'test-api-key'
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('should handle failed API key login', async () => {
|
|
65
|
+
// Arrange
|
|
66
|
+
const mockUserInfo = {
|
|
67
|
+
successful: false,
|
|
68
|
+
platformUserInfo: null,
|
|
69
|
+
returnMessage: {
|
|
70
|
+
messageType: 'error',
|
|
71
|
+
message: 'Invalid API key',
|
|
72
|
+
ttl: 3000
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const mockAdapter = global.testUtils.createMockAdapter({
|
|
77
|
+
getBasicAuth: jest.fn().mockReturnValue('dGVzdC1hcGkta2V5Og=='),
|
|
78
|
+
getUserInfo: jest.fn().mockResolvedValue(mockUserInfo)
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
adapterRegistry.getAdapter.mockReturnValue(mockAdapter);
|
|
82
|
+
|
|
83
|
+
const requestData = {
|
|
84
|
+
platform: 'testCRM',
|
|
85
|
+
hostname: 'test.example.com',
|
|
86
|
+
apiKey: 'invalid-api-key',
|
|
87
|
+
additionalInfo: {}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// Act
|
|
91
|
+
const result = await authHandler.onApiKeyLogin(requestData);
|
|
92
|
+
|
|
93
|
+
// Assert
|
|
94
|
+
expect(result.userInfo).toBeNull();
|
|
95
|
+
expect(result.returnMessage).toEqual(mockUserInfo.returnMessage);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test('should throw error when adapter not found', async () => {
|
|
99
|
+
// Arrange
|
|
100
|
+
adapterRegistry.getAdapter.mockImplementation(() => {
|
|
101
|
+
throw new Error('Adapter not found for platform: testCRM');
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const requestData = {
|
|
105
|
+
platform: 'testCRM',
|
|
106
|
+
hostname: 'test.example.com',
|
|
107
|
+
apiKey: 'test-api-key',
|
|
108
|
+
additionalInfo: {}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// Act & Assert
|
|
112
|
+
await expect(authHandler.onApiKeyLogin(requestData))
|
|
113
|
+
.rejects.toThrow('Adapter not found for platform: testCRM');
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe('authValidation', () => {
|
|
118
|
+
test('should validate user authentication successfully', async () => {
|
|
119
|
+
// Arrange
|
|
120
|
+
const mockUser = global.testUtils.createMockUser();
|
|
121
|
+
const mockValidationResponse = {
|
|
122
|
+
successful: true,
|
|
123
|
+
returnMessage: {
|
|
124
|
+
messageType: 'success',
|
|
125
|
+
message: 'Authentication valid',
|
|
126
|
+
ttl: 1000
|
|
127
|
+
},
|
|
128
|
+
status: 200
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const mockAdapter = global.testUtils.createMockAdapter({
|
|
132
|
+
getOauthInfo: jest.fn().mockResolvedValue({}),
|
|
133
|
+
authValidation: jest.fn().mockResolvedValue(mockValidationResponse)
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
adapterRegistry.getAdapter.mockReturnValue(mockAdapter);
|
|
137
|
+
|
|
138
|
+
// Mock UserModel.findOne to return a user
|
|
139
|
+
const { UserModel } = require('../../models/userModel');
|
|
140
|
+
jest.spyOn(UserModel, 'findOne').mockResolvedValue(mockUser);
|
|
141
|
+
|
|
142
|
+
// Mock oauth.checkAndRefreshAccessToken
|
|
143
|
+
const oauth = require('../../lib/oauth');
|
|
144
|
+
jest.spyOn(oauth, 'checkAndRefreshAccessToken').mockResolvedValue(mockUser);
|
|
145
|
+
|
|
146
|
+
const requestData = {
|
|
147
|
+
platform: 'testCRM',
|
|
148
|
+
userId: 'test-user-id'
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Act
|
|
152
|
+
const result = await authHandler.authValidation(requestData);
|
|
153
|
+
|
|
154
|
+
// Assert
|
|
155
|
+
expect(result).toEqual({
|
|
156
|
+
...mockValidationResponse,
|
|
157
|
+
failReason: ''
|
|
158
|
+
});
|
|
159
|
+
expect(mockAdapter.authValidation).toHaveBeenCalledWith({ user: mockUser });
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test('should handle user not found in database', async () => {
|
|
163
|
+
// Arrange
|
|
164
|
+
const mockAdapter = global.testUtils.createMockAdapter();
|
|
165
|
+
adapterRegistry.getAdapter.mockReturnValue(mockAdapter);
|
|
166
|
+
|
|
167
|
+
// Mock UserModel.findOne to return null (user not found)
|
|
168
|
+
const { UserModel } = require('../../models/userModel');
|
|
169
|
+
jest.spyOn(UserModel, 'findOne').mockResolvedValue(null);
|
|
170
|
+
|
|
171
|
+
const requestData = {
|
|
172
|
+
platform: 'testCRM',
|
|
173
|
+
userId: 'non-existent-user'
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// Act
|
|
177
|
+
const result = await authHandler.authValidation(requestData);
|
|
178
|
+
|
|
179
|
+
// Assert
|
|
180
|
+
expect(result).toEqual({
|
|
181
|
+
successful: false,
|
|
182
|
+
status: 404,
|
|
183
|
+
failReason: 'App Connect. User not found in database'
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test('should handle validation failure', async () => {
|
|
188
|
+
// Arrange
|
|
189
|
+
const mockUser = global.testUtils.createMockUser();
|
|
190
|
+
const mockValidationResponse = {
|
|
191
|
+
successful: false,
|
|
192
|
+
returnMessage: {
|
|
193
|
+
messageType: 'error',
|
|
194
|
+
message: 'Authentication failed',
|
|
195
|
+
ttl: 3000
|
|
196
|
+
},
|
|
197
|
+
status: 401
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const mockAdapter = global.testUtils.createMockAdapter({
|
|
201
|
+
getOauthInfo: jest.fn().mockResolvedValue({}),
|
|
202
|
+
authValidation: jest.fn().mockResolvedValue(mockValidationResponse)
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
adapterRegistry.getAdapter.mockReturnValue(mockAdapter);
|
|
206
|
+
|
|
207
|
+
// Mock UserModel.findOne to return a user
|
|
208
|
+
const { UserModel } = require('../../models/userModel');
|
|
209
|
+
jest.spyOn(UserModel, 'findOne').mockResolvedValue(mockUser);
|
|
210
|
+
|
|
211
|
+
// Mock oauth.checkAndRefreshAccessToken
|
|
212
|
+
const oauth = require('../../lib/oauth');
|
|
213
|
+
jest.spyOn(oauth, 'checkAndRefreshAccessToken').mockResolvedValue(mockUser);
|
|
214
|
+
|
|
215
|
+
const requestData = {
|
|
216
|
+
platform: 'testCRM',
|
|
217
|
+
userId: 'test-user-id'
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// Act
|
|
221
|
+
const result = await authHandler.authValidation(requestData);
|
|
222
|
+
|
|
223
|
+
// Assert
|
|
224
|
+
expect(result).toEqual({
|
|
225
|
+
...mockValidationResponse,
|
|
226
|
+
failReason: 'CRM. API failed'
|
|
227
|
+
});
|
|
228
|
+
expect(result.successful).toBe(false);
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
231
|
});
|