apacuana-sdk-core 0.8.0 → 0.10.0
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/README.md +150 -0
- package/coverage/clover.xml +233 -130
- package/coverage/coverage-final.json +8 -8
- package/coverage/lcov-report/index.html +29 -29
- package/coverage/lcov-report/src/api/certs.js.html +390 -9
- package/coverage/lcov-report/src/api/index.html +40 -40
- package/coverage/lcov-report/src/api/revocations.js.html +79 -43
- package/coverage/lcov-report/src/api/signatures.js.html +595 -73
- package/coverage/lcov-report/src/api/users.js.html +1 -1
- package/coverage/lcov-report/src/config/index.html +1 -1
- package/coverage/lcov-report/src/config/index.js.html +6 -6
- package/coverage/lcov-report/src/errors/index.html +1 -1
- package/coverage/lcov-report/src/errors/index.js.html +8 -8
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.js.html +58 -4
- package/coverage/lcov-report/src/utils/constant.js.html +4 -4
- package/coverage/lcov-report/src/utils/helpers.js.html +1 -1
- package/coverage/lcov-report/src/utils/httpClient.js.html +65 -35
- package/coverage/lcov-report/src/utils/index.html +15 -15
- package/coverage/lcov.info +422 -227
- package/dist/api/certs.d.ts +44 -0
- package/dist/api/signatures.d.ts +5 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +579 -79
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +579 -79
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/certs.js +127 -0
- package/src/api/revocations.js +14 -2
- package/src/api/signatures.js +174 -0
- package/src/index.js +20 -2
- package/src/utils/httpClient.js +29 -19
- package/tests/api/certs.test.js +113 -1
- package/tests/api/revocations.test.js +118 -5
- package/tests/api/signatures.test.js +306 -0
|
@@ -1,6 +1,119 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { httpRequest } from "../../src/utils/httpClient";
|
|
2
|
+
import { ApacuanaAPIError } from "../../src/errors";
|
|
3
|
+
import {
|
|
4
|
+
requestRevocation,
|
|
5
|
+
getRevocationReasons,
|
|
6
|
+
} from "../../src/api/revocations";
|
|
7
|
+
import { getConfig } from "../../src/config";
|
|
8
|
+
import { INTEGRATION_TYPE } from "../../src/utils/constant";
|
|
9
|
+
|
|
10
|
+
jest.mock("../../src/utils/httpClient");
|
|
11
|
+
jest.mock("../../src/config");
|
|
12
|
+
|
|
13
|
+
describe("Revocations API", () => {
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
jest.clearAllMocks();
|
|
5
16
|
});
|
|
6
|
-
|
|
17
|
+
|
|
18
|
+
describe("requestRevocation", () => {
|
|
19
|
+
it("should throw an error if reasonCode is not provided", async () => {
|
|
20
|
+
await expect(requestRevocation(null)).rejects.toThrow(
|
|
21
|
+
"Código de motivo es requerido para requestRevocation."
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should make a POST request to the correct endpoint with the reasonCode", async () => {
|
|
26
|
+
const reasonCode = "COMPROMISED";
|
|
27
|
+
const mockResponse = { success: true, message: "Revocation requested" };
|
|
28
|
+
httpRequest.mockResolvedValue(mockResponse);
|
|
29
|
+
|
|
30
|
+
const result = await requestRevocation(reasonCode);
|
|
31
|
+
|
|
32
|
+
expect(httpRequest).toHaveBeenCalledWith(
|
|
33
|
+
"services/api/onboardingclient/requestcert",
|
|
34
|
+
{ reason: reasonCode },
|
|
35
|
+
"POST"
|
|
36
|
+
);
|
|
37
|
+
expect(result).toEqual(mockResponse);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("should throw a generic error if the httpRequest fails", async () => {
|
|
41
|
+
const reasonCode = "COMPROMISED";
|
|
42
|
+
const apiError = new Error("Network error");
|
|
43
|
+
httpRequest.mockRejectedValue(apiError);
|
|
44
|
+
|
|
45
|
+
await expect(requestRevocation(reasonCode)).rejects.toThrow(
|
|
46
|
+
`Fallo en la solicitud de revocación: ${apiError.message}`
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe("getRevocationReasons", () => {
|
|
52
|
+
it("should make a GET request and return the reasons for ONBOARDING", async () => {
|
|
53
|
+
getConfig.mockReturnValue({
|
|
54
|
+
integrationType: INTEGRATION_TYPE.ONBOARDING,
|
|
55
|
+
});
|
|
56
|
+
const mockReasons = [
|
|
57
|
+
{ code: "0", description: "Unspecified" },
|
|
58
|
+
{ code: "1", description: "Key Compromise" },
|
|
59
|
+
];
|
|
60
|
+
httpRequest.mockResolvedValue({ records: mockReasons });
|
|
61
|
+
|
|
62
|
+
const result = await getRevocationReasons();
|
|
63
|
+
|
|
64
|
+
expect(httpRequest).toHaveBeenCalledWith(
|
|
65
|
+
"GET",
|
|
66
|
+
"config/api/revocation/reasonsonboarding",
|
|
67
|
+
{}
|
|
68
|
+
);
|
|
69
|
+
expect(result).toEqual(mockReasons);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("should throw an error if the API response does not contain 'records'", async () => {
|
|
73
|
+
getConfig.mockReturnValue({
|
|
74
|
+
integrationType: INTEGRATION_TYPE.ONBOARDING,
|
|
75
|
+
});
|
|
76
|
+
httpRequest.mockResolvedValue({ data: [] }); // Respuesta inválida
|
|
77
|
+
|
|
78
|
+
await expect(getRevocationReasons()).rejects.toThrow(
|
|
79
|
+
new ApacuanaAPIError("Failed to fetch revocation reasons.")
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("should re-throw ApacuanaAPIError if caught", async () => {
|
|
84
|
+
getConfig.mockReturnValue({
|
|
85
|
+
integrationType: INTEGRATION_TYPE.ONBOARDING,
|
|
86
|
+
});
|
|
87
|
+
const apiError = new ApacuanaAPIError("API is down", 500);
|
|
88
|
+
httpRequest.mockRejectedValue(apiError);
|
|
89
|
+
|
|
90
|
+
await expect(getRevocationReasons()).rejects.toThrow(apiError);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("should throw a generic error for other types of errors", async () => {
|
|
94
|
+
getConfig.mockReturnValue({
|
|
95
|
+
integrationType: INTEGRATION_TYPE.ONBOARDING,
|
|
96
|
+
});
|
|
97
|
+
const genericError = new Error("Something went wrong");
|
|
98
|
+
httpRequest.mockRejectedValue(genericError);
|
|
99
|
+
|
|
100
|
+
await expect(getRevocationReasons()).rejects.toThrow(
|
|
101
|
+
"Failed to get revocation reasons. Please try again later."
|
|
102
|
+
);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it("should throw not implemented for ONPREMISE integration", async () => {
|
|
106
|
+
getConfig.mockReturnValue({
|
|
107
|
+
integrationType: INTEGRATION_TYPE.ONPREMISE,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
await expect(getRevocationReasons()).rejects.toThrow(
|
|
111
|
+
new ApacuanaAPIError(
|
|
112
|
+
"Get revocation reasons is not supported for integration type: ONPREMISE",
|
|
113
|
+
501,
|
|
114
|
+
"NOT_IMPLEMENTED"
|
|
115
|
+
)
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
@@ -6,6 +6,9 @@ import {
|
|
|
6
6
|
getDocs,
|
|
7
7
|
getDigest,
|
|
8
8
|
signDocument,
|
|
9
|
+
uploadSignatureVariant,
|
|
10
|
+
getSignatureVariant,
|
|
11
|
+
deleteSignatureVariant,
|
|
9
12
|
} from "../../src/api/signatures";
|
|
10
13
|
import helpers from "../../src/utils/helpers";
|
|
11
14
|
import { INTEGRATION_TYPE } from "../../src/utils/constant";
|
|
@@ -19,6 +22,7 @@ jest.mock("../../src/utils/helpers", () => ({
|
|
|
19
22
|
signDigest: jest.fn(),
|
|
20
23
|
validateGetDocsData: jest.fn(),
|
|
21
24
|
validateGetDigestData: jest.fn(),
|
|
25
|
+
validateOnBoardingSignDocumentData: jest.fn(),
|
|
22
26
|
}));
|
|
23
27
|
|
|
24
28
|
describe("API - Signatures", () => {
|
|
@@ -158,4 +162,306 @@ describe("API - Signatures", () => {
|
|
|
158
162
|
);
|
|
159
163
|
});
|
|
160
164
|
});
|
|
165
|
+
|
|
166
|
+
describe("getDigest", () => {
|
|
167
|
+
const signData = {
|
|
168
|
+
cert: "test-cert",
|
|
169
|
+
signatureId: "test-signature-id",
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
it("should get digest for ONBOARDING integration", async () => {
|
|
173
|
+
getConfig.mockReturnValue({
|
|
174
|
+
integrationType: INTEGRATION_TYPE.ONBOARDING,
|
|
175
|
+
});
|
|
176
|
+
const mockResponse = { data: { digest: "test-digest" } };
|
|
177
|
+
httpRequest.mockResolvedValue(mockResponse);
|
|
178
|
+
|
|
179
|
+
const result = await getDigest(signData);
|
|
180
|
+
|
|
181
|
+
expect(helpers.validateGetDigestData).toHaveBeenCalledWith(signData);
|
|
182
|
+
expect(httpRequest).toHaveBeenCalledWith(
|
|
183
|
+
`services/api/documents/getdigest/${signData.signatureId}`,
|
|
184
|
+
{ publickey: signData.cert },
|
|
185
|
+
"POST"
|
|
186
|
+
);
|
|
187
|
+
expect(result).toEqual({ digest: "test-digest", success: true });
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it("should throw an error if digest is not in response for ONBOARDING", async () => {
|
|
191
|
+
getConfig.mockReturnValue({
|
|
192
|
+
integrationType: INTEGRATION_TYPE.ONBOARDING,
|
|
193
|
+
});
|
|
194
|
+
httpRequest.mockResolvedValue({ data: {} });
|
|
195
|
+
|
|
196
|
+
await expect(getDigest(signData)).rejects.toThrow(
|
|
197
|
+
new ApacuanaAPIError(
|
|
198
|
+
"Signature generation failed: digest not found in the response.",
|
|
199
|
+
500,
|
|
200
|
+
"API_RESPONSE_ERROR"
|
|
201
|
+
)
|
|
202
|
+
);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it("should throw not implemented for ONPREMISE integration", async () => {
|
|
206
|
+
getConfig.mockReturnValue({
|
|
207
|
+
integrationType: INTEGRATION_TYPE.ONPREMISE,
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
await expect(getDigest(signData)).rejects.toThrow(
|
|
211
|
+
new ApacuanaAPIError(
|
|
212
|
+
"Digest retrieval is not supported for integration type: ONPREMISE",
|
|
213
|
+
501,
|
|
214
|
+
"NOT_IMPLEMENTED"
|
|
215
|
+
)
|
|
216
|
+
);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it("should throw an error for unsupported integration type", async () => {
|
|
220
|
+
getConfig.mockReturnValue({ integrationType: "UNSUPPORTED" });
|
|
221
|
+
await expect(getDigest(signData)).rejects.toThrow(
|
|
222
|
+
"Document retrieval is not supported for an unknown integration type: UNSUPPORTED"
|
|
223
|
+
);
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
describe("signDocument", () => {
|
|
228
|
+
const signData = {
|
|
229
|
+
signature: {
|
|
230
|
+
id: "test-signature-id",
|
|
231
|
+
positions: [{ x: 0.1, y: 0.2, page: 1 }],
|
|
232
|
+
},
|
|
233
|
+
cert: "test-cert",
|
|
234
|
+
signedDigest: "test-signed-digest",
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
it("should sign document for ONBOARDING integration", async () => {
|
|
238
|
+
getConfig.mockReturnValue({
|
|
239
|
+
integrationType: INTEGRATION_TYPE.ONBOARDING,
|
|
240
|
+
});
|
|
241
|
+
const mockResponse = { success: true };
|
|
242
|
+
httpRequest.mockResolvedValue(mockResponse);
|
|
243
|
+
|
|
244
|
+
const result = await signDocument(signData);
|
|
245
|
+
|
|
246
|
+
expect(
|
|
247
|
+
helpers.validateOnBoardingSignDocumentData
|
|
248
|
+
).toHaveBeenCalledWith(signData);
|
|
249
|
+
expect(httpRequest).toHaveBeenCalledWith(
|
|
250
|
+
`services/api/documents/sign/${signData.signature.id}`,
|
|
251
|
+
{
|
|
252
|
+
positions: JSON.stringify([
|
|
253
|
+
{ x: 0.1, y: 0.2, page: 1, status: 1 },
|
|
254
|
+
]),
|
|
255
|
+
publickey: signData.cert,
|
|
256
|
+
signeddigest: signData.signedDigest,
|
|
257
|
+
},
|
|
258
|
+
"PUT"
|
|
259
|
+
);
|
|
260
|
+
expect(result).toEqual(mockResponse);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it("should throw not implemented for ONPREMISE integration", async () => {
|
|
264
|
+
getConfig.mockReturnValue({
|
|
265
|
+
integrationType: INTEGRATION_TYPE.ONPREMISE,
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
await expect(signDocument(signData)).rejects.toThrow(
|
|
269
|
+
new ApacuanaAPIError(
|
|
270
|
+
"Document signing is not supported for integration type: ONPREMISE",
|
|
271
|
+
501,
|
|
272
|
+
"NOT_IMPLEMENTED"
|
|
273
|
+
)
|
|
274
|
+
);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it("should throw an error for unsupported integration type", async () => {
|
|
278
|
+
getConfig.mockReturnValue({ integrationType: "UNSUPPORTED" });
|
|
279
|
+
await expect(signDocument(signData)).rejects.toThrow(
|
|
280
|
+
new ApacuanaAPIError(
|
|
281
|
+
"Unsupported integration type: UNSUPPORTED",
|
|
282
|
+
400,
|
|
283
|
+
"UNSUPPORTED_INTEGRATION_TYPE"
|
|
284
|
+
)
|
|
285
|
+
);
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
describe("uploadSignatureVariant", () => {
|
|
290
|
+
beforeAll(() => {
|
|
291
|
+
// Define a global mock for File to simulate a browser environment
|
|
292
|
+
global.File = class MockFile {
|
|
293
|
+
constructor(parts, filename, options) {
|
|
294
|
+
this.type = options ? options.type : "";
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
afterAll(() => {
|
|
300
|
+
// Clean up the global mock
|
|
301
|
+
delete global.File;
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
it("should throw an error if data or data.file is not provided", async () => {
|
|
305
|
+
await expect(uploadSignatureVariant(null)).rejects.toThrow(
|
|
306
|
+
new ApacuanaAPIError("El parámetro 'file' es requerido.", 400, "INVALID_PARAMETER")
|
|
307
|
+
);
|
|
308
|
+
await expect(uploadSignatureVariant({})).rejects.toThrow(
|
|
309
|
+
new ApacuanaAPIError("El parámetro 'file' es requerido.", 400, "INVALID_PARAMETER")
|
|
310
|
+
);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
it("should throw an error if file is not a File instance", async () => {
|
|
314
|
+
await expect(uploadSignatureVariant({ file: {} })).rejects.toThrow(
|
|
315
|
+
new ApacuanaAPIError(
|
|
316
|
+
"El parámetro 'file' debe ser una instancia de 'File'.",
|
|
317
|
+
400,
|
|
318
|
+
"INVALID_PARAMETER"
|
|
319
|
+
)
|
|
320
|
+
);
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
it("should throw an error if file is not a PNG", async () => {
|
|
324
|
+
const invalidFile = new File([], "test.txt", { type: "text/plain" });
|
|
325
|
+
await expect(uploadSignatureVariant({ file: invalidFile })).rejects.toThrow(
|
|
326
|
+
new ApacuanaAPIError(
|
|
327
|
+
"El archivo debe ser de tipo PNG (image/png).",
|
|
328
|
+
400,
|
|
329
|
+
"INVALID_PARAMETER"
|
|
330
|
+
)
|
|
331
|
+
);
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it("should upload file for ONBOARDING integration", async () => {
|
|
335
|
+
getConfig.mockReturnValue({
|
|
336
|
+
integrationType: INTEGRATION_TYPE.ONBOARDING,
|
|
337
|
+
});
|
|
338
|
+
const validFile = new File([], "signature.png", { type: "image/png" });
|
|
339
|
+
const data = { file: validFile };
|
|
340
|
+
httpRequest.mockResolvedValue({ success: true, id: "123" });
|
|
341
|
+
|
|
342
|
+
const result = await uploadSignatureVariant(data);
|
|
343
|
+
|
|
344
|
+
expect(httpRequest).toHaveBeenCalledWith(
|
|
345
|
+
"services/api/customer/signaturephoto",
|
|
346
|
+
{ file: validFile },
|
|
347
|
+
"POST"
|
|
348
|
+
);
|
|
349
|
+
expect(result).toEqual({ success: true, id: "123" });
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
it("should throw not implemented for ONPREMISE integration", async () => {
|
|
353
|
+
getConfig.mockReturnValue({
|
|
354
|
+
integrationType: INTEGRATION_TYPE.ONPREMISE,
|
|
355
|
+
});
|
|
356
|
+
const validFile = new File([], "signature.png", { type: "image/png" });
|
|
357
|
+
await expect(uploadSignatureVariant({ file: validFile })).rejects.toThrow(
|
|
358
|
+
new ApacuanaAPIError(
|
|
359
|
+
"Uploading signature variants is not supported for integration type: ONPREMISE",
|
|
360
|
+
501,
|
|
361
|
+
"NOT_IMPLEMENTED"
|
|
362
|
+
)
|
|
363
|
+
);
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
it("should throw an error for unsupported integration type", async () => {
|
|
367
|
+
getConfig.mockReturnValue({ integrationType: "UNSUPPORTED" });
|
|
368
|
+
const validFile = new File([], "signature.png", { type: "image/png" });
|
|
369
|
+
await expect(uploadSignatureVariant({ file: validFile })).rejects.toThrow(
|
|
370
|
+
new ApacuanaAPIError(
|
|
371
|
+
"Unsupported integration type: UNSUPPORTED",
|
|
372
|
+
400,
|
|
373
|
+
"UNSUPPORTED_INTEGRATION_TYPE"
|
|
374
|
+
)
|
|
375
|
+
);
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
describe("getSignatureVariant", () => {
|
|
380
|
+
it("should get signature variant for ONBOARDING integration", async () => {
|
|
381
|
+
getConfig.mockReturnValue({
|
|
382
|
+
integrationType: INTEGRATION_TYPE.ONBOARDING,
|
|
383
|
+
customerId: "test-customer",
|
|
384
|
+
});
|
|
385
|
+
const mockResponse = { success: true, file: "base64-encoded-file" };
|
|
386
|
+
httpRequest.mockResolvedValue(mockResponse);
|
|
387
|
+
|
|
388
|
+
const result = await getSignatureVariant();
|
|
389
|
+
|
|
390
|
+
expect(httpRequest).toHaveBeenCalledWith(
|
|
391
|
+
"services/api/customer/getsignaturephotosdk/test-customer",
|
|
392
|
+
{},
|
|
393
|
+
"GET"
|
|
394
|
+
);
|
|
395
|
+
expect(result).toEqual(mockResponse);
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
it("should throw not implemented for ONPREMISE integration", async () => {
|
|
399
|
+
getConfig.mockReturnValue({
|
|
400
|
+
integrationType: INTEGRATION_TYPE.ONPREMISE,
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
await expect(getSignatureVariant()).rejects.toThrow(
|
|
404
|
+
new ApacuanaAPIError(
|
|
405
|
+
"Getting signature variants is not supported for integration type: ONPREMISE",
|
|
406
|
+
501,
|
|
407
|
+
"NOT_IMPLEMENTED"
|
|
408
|
+
)
|
|
409
|
+
);
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
it("should throw an error for unsupported integration type", async () => {
|
|
413
|
+
getConfig.mockReturnValue({ integrationType: "UNSUPPORTED" });
|
|
414
|
+
await expect(getSignatureVariant()).rejects.toThrow(
|
|
415
|
+
new ApacuanaAPIError(
|
|
416
|
+
"Unsupported integration type: UNSUPPORTED",
|
|
417
|
+
400,
|
|
418
|
+
"UNSUPPORTED_INTEGRATION_TYPE"
|
|
419
|
+
)
|
|
420
|
+
);
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
describe("deleteSignatureVariant", () => {
|
|
425
|
+
it("should delete signature variant for ONBOARDING integration", async () => {
|
|
426
|
+
getConfig.mockReturnValue({
|
|
427
|
+
integrationType: INTEGRATION_TYPE.ONBOARDING,
|
|
428
|
+
});
|
|
429
|
+
const mockResponse = { success: true, message: "Deleted" };
|
|
430
|
+
httpRequest.mockResolvedValue(mockResponse);
|
|
431
|
+
|
|
432
|
+
const result = await deleteSignatureVariant();
|
|
433
|
+
|
|
434
|
+
expect(httpRequest).toHaveBeenCalledWith(
|
|
435
|
+
"services/api/customer/cleansignaturephoto",
|
|
436
|
+
{},
|
|
437
|
+
"DELETE"
|
|
438
|
+
);
|
|
439
|
+
expect(result).toEqual(mockResponse);
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
it("should throw not implemented for ONPREMISE integration", async () => {
|
|
443
|
+
getConfig.mockReturnValue({
|
|
444
|
+
integrationType: INTEGRATION_TYPE.ONPREMISE,
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
await expect(deleteSignatureVariant()).rejects.toThrow(
|
|
448
|
+
new ApacuanaAPIError(
|
|
449
|
+
"Deleting signature variants is not supported for integration type: ONPREMISE",
|
|
450
|
+
501,
|
|
451
|
+
"NOT_IMPLEMENTED"
|
|
452
|
+
)
|
|
453
|
+
);
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
it("should throw an error for unsupported integration type", async () => {
|
|
457
|
+
getConfig.mockReturnValue({ integrationType: "UNSUPPORTED" });
|
|
458
|
+
await expect(deleteSignatureVariant()).rejects.toThrow(
|
|
459
|
+
new ApacuanaAPIError(
|
|
460
|
+
"Unsupported integration type: UNSUPPORTED",
|
|
461
|
+
400,
|
|
462
|
+
"UNSUPPORTED_INTEGRATION_TYPE"
|
|
463
|
+
)
|
|
464
|
+
);
|
|
465
|
+
});
|
|
466
|
+
});
|
|
161
467
|
});
|