boldsign 1.0.2 → 1.0.3

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.
Files changed (156) hide show
  1. package/.openapi-generator/FILES +4 -0
  2. package/README.md +4 -0
  3. package/api/apis.ts +1 -1
  4. package/dist/api/apis.d.ts +1 -1
  5. package/dist/api/apis.js +1 -1
  6. package/dist/model/added.d.ts +16 -0
  7. package/dist/model/added.js +28 -0
  8. package/dist/model/added.js.map +1 -0
  9. package/dist/model/auditTrail.d.ts +5 -0
  10. package/dist/model/auditTrail.js +15 -0
  11. package/dist/model/auditTrail.js.map +1 -1
  12. package/dist/model/authenticationSettings.d.ts +2 -1
  13. package/dist/model/authenticationSettings.js +1 -0
  14. package/dist/model/authenticationSettings.js.map +1 -1
  15. package/dist/model/customFormField.d.ts +2 -1
  16. package/dist/model/customFormField.js +1 -0
  17. package/dist/model/customFormField.js.map +1 -1
  18. package/dist/model/documentExpirySettings.d.ts +2 -1
  19. package/dist/model/documentExpirySettings.js +1 -0
  20. package/dist/model/documentExpirySettings.js.map +1 -1
  21. package/dist/model/documentFormFields.d.ts +2 -1
  22. package/dist/model/documentFormFields.js +1 -0
  23. package/dist/model/documentFormFields.js.map +1 -1
  24. package/dist/model/embeddedDocumentRequest.d.ts +5 -3
  25. package/dist/model/embeddedDocumentRequest.js +2 -0
  26. package/dist/model/embeddedDocumentRequest.js.map +1 -1
  27. package/dist/model/embeddedMergeTemplateFormRequest.d.ts +4 -2
  28. package/dist/model/embeddedMergeTemplateFormRequest.js +2 -0
  29. package/dist/model/embeddedMergeTemplateFormRequest.js.map +1 -1
  30. package/dist/model/embeddedSendTemplateFormRequest.d.ts +4 -2
  31. package/dist/model/embeddedSendTemplateFormRequest.js +2 -0
  32. package/dist/model/embeddedSendTemplateFormRequest.js.map +1 -1
  33. package/dist/model/font.d.ts +4 -2
  34. package/dist/model/font.js +2 -0
  35. package/dist/model/font.js.map +1 -1
  36. package/dist/model/formField.d.ts +2 -1
  37. package/dist/model/formField.js +1 -0
  38. package/dist/model/formField.js.map +1 -1
  39. package/dist/model/identityVerificationSettings.d.ts +4 -2
  40. package/dist/model/identityVerificationSettings.js +2 -0
  41. package/dist/model/identityVerificationSettings.js.map +1 -1
  42. package/dist/model/index.d.ts +5 -1
  43. package/dist/model/index.js +15 -3
  44. package/dist/model/index.js.map +1 -1
  45. package/dist/model/mergeAndSendForSignForm.d.ts +4 -2
  46. package/dist/model/mergeAndSendForSignForm.js +2 -0
  47. package/dist/model/mergeAndSendForSignForm.js.map +1 -1
  48. package/dist/model/modificationDetails.d.ts +15 -0
  49. package/dist/model/modificationDetails.js +23 -0
  50. package/dist/model/modificationDetails.js.map +1 -0
  51. package/dist/model/recipientChangeLog.d.ts +17 -0
  52. package/dist/model/recipientChangeLog.js +23 -0
  53. package/dist/model/recipientChangeLog.js.map +1 -0
  54. package/dist/model/removed.d.ts +16 -0
  55. package/dist/model/removed.js +28 -0
  56. package/dist/model/removed.js.map +1 -0
  57. package/dist/model/role.d.ts +2 -1
  58. package/dist/model/role.js +1 -0
  59. package/dist/model/role.js.map +1 -1
  60. package/dist/model/sendForSign.d.ts +4 -2
  61. package/dist/model/sendForSign.js +2 -0
  62. package/dist/model/sendForSign.js.map +1 -1
  63. package/dist/model/sendForSignFromTemplateForm.d.ts +4 -2
  64. package/dist/model/sendForSignFromTemplateForm.js +2 -0
  65. package/dist/model/sendForSignFromTemplateForm.js.map +1 -1
  66. package/dist/model/templateFormFields.d.ts +2 -1
  67. package/dist/model/templateFormFields.js +1 -0
  68. package/dist/model/templateFormFields.js.map +1 -1
  69. package/dist/model/textTagDefinition.d.ts +2 -1
  70. package/dist/model/textTagDefinition.js +1 -0
  71. package/dist/model/textTagDefinition.js.map +1 -1
  72. package/docs/Added.md +13 -0
  73. package/docs/AuditTrail.md +3 -0
  74. package/docs/ModificationDetails.md +12 -0
  75. package/docs/RecipientChangeLog.md +12 -0
  76. package/docs/Removed.md +13 -0
  77. package/model/added.ts +43 -0
  78. package/model/auditTrail.ts +20 -0
  79. package/model/authenticationSettings.ts +2 -1
  80. package/model/customFormField.ts +2 -1
  81. package/model/documentExpirySettings.ts +2 -1
  82. package/model/documentFormFields.ts +2 -1
  83. package/model/embeddedDocumentRequest.ts +5 -3
  84. package/model/embeddedMergeTemplateFormRequest.ts +4 -2
  85. package/model/embeddedSendTemplateFormRequest.ts +4 -2
  86. package/model/font.ts +4 -2
  87. package/model/formField.ts +2 -1
  88. package/model/identityVerificationSettings.ts +4 -2
  89. package/model/index.ts +12 -0
  90. package/model/mergeAndSendForSignForm.ts +4 -2
  91. package/model/modificationDetails.ts +37 -0
  92. package/model/recipientChangeLog.ts +39 -0
  93. package/model/removed.ts +43 -0
  94. package/model/role.ts +2 -1
  95. package/model/sendForSign.ts +4 -2
  96. package/model/sendForSignFromTemplateForm.ts +4 -2
  97. package/model/templateFormFields.ts +2 -1
  98. package/model/textTagDefinition.ts +2 -1
  99. package/package.json +1 -1
  100. package/dist/tests/config.d.ts +0 -5
  101. package/dist/tests/config.js +0 -43
  102. package/dist/tests/config.js.map +0 -1
  103. package/dist/tests/integration/BrandingApiTest.spec.d.ts +0 -1
  104. package/dist/tests/integration/BrandingApiTest.spec.js +0 -310
  105. package/dist/tests/integration/BrandingApiTest.spec.js.map +0 -1
  106. package/dist/tests/integration/ContactsApiTest.spec.d.ts +0 -1
  107. package/dist/tests/integration/ContactsApiTest.spec.js +0 -249
  108. package/dist/tests/integration/ContactsApiTest.spec.js.map +0 -1
  109. package/dist/tests/integration/CustomFieldApiTest.spec.d.ts +0 -1
  110. package/dist/tests/integration/CustomFieldApiTest.spec.js +0 -289
  111. package/dist/tests/integration/CustomFieldApiTest.spec.js.map +0 -1
  112. package/dist/tests/integration/DocumentApiTest.spec.d.ts +0 -1
  113. package/dist/tests/integration/DocumentApiTest.spec.js +0 -1691
  114. package/dist/tests/integration/DocumentApiTest.spec.js.map +0 -1
  115. package/dist/tests/integration/TemplateApiTest.spec.d.ts +0 -1
  116. package/dist/tests/integration/TemplateApiTest.spec.js +0 -1440
  117. package/dist/tests/integration/TemplateApiTest.spec.js.map +0 -1
  118. package/dist/tests/integration/planApiTest.spec.d.ts +0 -1
  119. package/dist/tests/integration/planApiTest.spec.js +0 -41
  120. package/dist/tests/integration/planApiTest.spec.js.map +0 -1
  121. package/dist/tests/integration/senderIdentity.spec.d.ts +0 -1
  122. package/dist/tests/integration/senderIdentity.spec.js +0 -481
  123. package/dist/tests/integration/senderIdentity.spec.js.map +0 -1
  124. package/dist/tests/integration/teamsApiTest.spec.d.ts +0 -1
  125. package/dist/tests/integration/teamsApiTest.spec.js +0 -230
  126. package/dist/tests/integration/teamsApiTest.spec.js.map +0 -1
  127. package/dist/tests/integration/usersApiTest.spec.d.ts +0 -1
  128. package/dist/tests/integration/usersApiTest.spec.js +0 -290
  129. package/dist/tests/integration/usersApiTest.spec.js.map +0 -1
  130. package/dist/tests/unit/brandingApi.spec.d.ts +0 -1
  131. package/dist/tests/unit/brandingApi.spec.js +0 -174
  132. package/dist/tests/unit/brandingApi.spec.js.map +0 -1
  133. package/dist/tests/unit/contactsApi.spec.d.ts +0 -1
  134. package/dist/tests/unit/contactsApi.spec.js +0 -154
  135. package/dist/tests/unit/contactsApi.spec.js.map +0 -1
  136. package/dist/tests/unit/customFieldApi.spec.d.ts +0 -1
  137. package/dist/tests/unit/customFieldApi.spec.js +0 -140
  138. package/dist/tests/unit/customFieldApi.spec.js.map +0 -1
  139. package/dist/tests/unit/documentApi.spec.d.ts +0 -1
  140. package/dist/tests/unit/documentApi.spec.js +0 -476
  141. package/dist/tests/unit/documentApi.spec.js.map +0 -1
  142. package/dist/tests/unit/planApi.spec.d.ts +0 -1
  143. package/dist/tests/unit/planApi.spec.js +0 -69
  144. package/dist/tests/unit/planApi.spec.js.map +0 -1
  145. package/dist/tests/unit/senderIdentitiesApi.spec.d.ts +0 -1
  146. package/dist/tests/unit/senderIdentitiesApi.spec.js +0 -148
  147. package/dist/tests/unit/senderIdentitiesApi.spec.js.map +0 -1
  148. package/dist/tests/unit/teamApi.spec.d.ts +0 -1
  149. package/dist/tests/unit/teamApi.spec.js +0 -116
  150. package/dist/tests/unit/teamApi.spec.js.map +0 -1
  151. package/dist/tests/unit/templateApi.spec.d.ts +0 -1
  152. package/dist/tests/unit/templateApi.spec.js +0 -285
  153. package/dist/tests/unit/templateApi.spec.js.map +0 -1
  154. package/dist/tests/unit/userApi.spec.d.ts +0 -1
  155. package/dist/tests/unit/userApi.spec.js +0 -163
  156. package/dist/tests/unit/userApi.spec.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "boldsign",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "NodeJS client for boldsign",
5
5
  "keywords": [
6
6
  "boldsign",
@@ -1,5 +0,0 @@
1
- declare const config: {
2
- apiKey: string | undefined;
3
- baseUrl: string | undefined;
4
- };
5
- export default config;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- const dotenv = __importStar(require("dotenv"));
37
- dotenv.config();
38
- const config = {
39
- apiKey: process.env.API_KEY,
40
- baseUrl: process.env.HOST_URL
41
- };
42
- exports.default = config;
43
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../tests/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,MAAM,GAAG;IACX,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;IAC3B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ;CAChC,CAAC;AACF,kBAAe,MAAM,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,310 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- var __importDefault = (this && this.__importDefault) || function (mod) {
45
- return (mod && mod.__esModule) ? mod : { "default": mod };
46
- };
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- const brandingApi_1 = require("../../api/brandingApi");
49
- const config_1 = __importDefault(require("../config"));
50
- const fs = __importStar(require("fs"));
51
- describe('Test suite', () => {
52
- let brandingApi;
53
- let brandId;
54
- beforeAll(() => {
55
- brandId = null;
56
- const apiKey = config_1.default.apiKey;
57
- const baseUrl = config_1.default.baseUrl;
58
- if (!baseUrl || !apiKey) {
59
- throw new Error("Environment variables 'HOST_URL' or 'API_KEY' are not set");
60
- }
61
- brandingApi = new brandingApi_1.BrandingApi(baseUrl);
62
- brandingApi.setApiKey(apiKey);
63
- });
64
- test('Test1:should create a brand successfully', () => __awaiter(void 0, void 0, void 0, function* () {
65
- const brandName = "NodeSDK";
66
- const brandLogo = fs.createReadStream("tests/documents/logo.jpg");
67
- const backgroundColor = "Blue";
68
- const buttonColor = "Black";
69
- const buttonTextColor = "White";
70
- const emailDisplayName = "{SenderName} from Syncfusion";
71
- try {
72
- const createBrandApiResponse = yield brandingApi.createBrand(brandName, brandLogo, backgroundColor, buttonColor, buttonTextColor, emailDisplayName);
73
- console.log("Brand created successfully:", createBrandApiResponse.brandId);
74
- brandId = createBrandApiResponse.brandId;
75
- expect(brandId).toBeDefined();
76
- expect(brandId).toBeGreaterThan(0);
77
- }
78
- catch (error) {
79
- console.log("Error occurred while creating the brand:", error.message);
80
- }
81
- }), 20000);
82
- test('Test2:should create a brand only with required fields', () => __awaiter(void 0, void 0, void 0, function* () {
83
- const brandName = "NodeSDK";
84
- const brandLogo = fs.createReadStream("tests/documents/logo.jpg");
85
- try {
86
- const createBrandApiResponse = yield brandingApi.createBrand(brandName, brandLogo);
87
- console.log("Brand created successfully:", createBrandApiResponse.brandId);
88
- expect(createBrandApiResponse).toBeDefined();
89
- }
90
- catch (error) {
91
- console.log("Error occurred while creating the brand:", error);
92
- expect(error).toBeUndefined();
93
- }
94
- }), 20000);
95
- test('Test3:should fail to create a brand without brand name', () => __awaiter(void 0, void 0, void 0, function* () {
96
- const brandName = "";
97
- const brandLogo = fs.createReadStream("tests/documents/logo.jpg");
98
- const backgroundColor = "Blue";
99
- const buttonColor = "Black";
100
- const buttonTextColor = "White";
101
- const emailDisplayName = "{SenderName} from Syncfusion";
102
- try {
103
- yield brandingApi.createBrand(brandName, brandLogo, backgroundColor, buttonColor, buttonTextColor, emailDisplayName);
104
- throw new Error("API call should have failed");
105
- }
106
- catch (error) {
107
- console.error("Error occurred while creating the brand:", error.message);
108
- expect(error.message).toBeDefined();
109
- }
110
- }), 20000);
111
- test('Test4:should fail to create a brand with invalid background color', () => __awaiter(void 0, void 0, void 0, function* () {
112
- var _a;
113
- const brandName = "Node SDK";
114
- const brandLogo = fs.createReadStream("tests/documents/logo.jpg");
115
- const backgroundColor = "invalid-color";
116
- const buttonColor = "Black";
117
- const buttonTextColor = "White";
118
- const emailDisplayName = "{SenderName} from Syncfusion";
119
- try {
120
- yield brandingApi.createBrand(brandName, brandLogo, backgroundColor, buttonColor, buttonTextColor, emailDisplayName);
121
- throw new Error("API call should have failed due to invalid background color");
122
- }
123
- catch (error) {
124
- console.error("Expected error for invalid background color:", error);
125
- expect(error.response).toBeDefined();
126
- expect((_a = error.response) === null || _a === void 0 ? void 0 : _a.status).toBe(400);
127
- expect(error.response.statusText).toBe("Bad Request");
128
- }
129
- }), 20000);
130
- test('Test5:should fail to create a brand with invalid button color', () => __awaiter(void 0, void 0, void 0, function* () {
131
- var _a;
132
- const brandName = "Node SDK";
133
- const brandLogo = fs.createReadStream("tests/documents/logo.jpg");
134
- const backgroundColor = "Blue";
135
- const buttonColor = "not-a-color";
136
- const buttonTextColor = "White";
137
- const emailDisplayName = "{SenderName} from Syncfusion";
138
- try {
139
- yield brandingApi.createBrand(brandName, brandLogo, backgroundColor, buttonColor, buttonTextColor, emailDisplayName);
140
- throw new Error("API call should have failed due to invalid button color");
141
- }
142
- catch (error) {
143
- console.error("Expected error for invalid button color:", error);
144
- expect(error.response).toBeDefined();
145
- expect((_a = error.response) === null || _a === void 0 ? void 0 : _a.status).toBe(400);
146
- expect(error.response.statusText).toBe("Bad Request");
147
- }
148
- }), 20000);
149
- test('Test6:should fail to create a brand with invalid button text color', () => __awaiter(void 0, void 0, void 0, function* () {
150
- var _a;
151
- const brandName = "Node SDK";
152
- const brandLogo = fs.createReadStream("tests/documents/logo.jpg");
153
- const backgroundColor = "Blue";
154
- const buttonColor = "Black";
155
- const buttonTextColor = "invalid-text-color";
156
- const emailDisplayName = "{SenderName} from Syncfusion";
157
- try {
158
- yield brandingApi.createBrand(brandName, brandLogo, backgroundColor, buttonColor, buttonTextColor, emailDisplayName);
159
- throw new Error("API call should have failed due to invalid button text color");
160
- }
161
- catch (error) {
162
- console.error("Expected error for invalid button text color:", error);
163
- expect(error.response).toBeDefined();
164
- expect((_a = error.response) === null || _a === void 0 ? void 0 : _a.status).toBe(400);
165
- expect(error.response.statusText).toBe("Bad Request");
166
- }
167
- }), 20000);
168
- test('Test7:should fail to create a brand with invalid logo path', () => __awaiter(void 0, void 0, void 0, function* () {
169
- var _a;
170
- const brandName = "Node SDK";
171
- const brandLogo = fs.createReadStream("tests/documents/agreement.pdf");
172
- try {
173
- yield brandingApi.createBrand(brandName, brandLogo);
174
- throw new Error("API call should have failed due to invalid button text color");
175
- }
176
- catch (error) {
177
- console.error("Expected error for invalid button text color:", error);
178
- expect(error.response).toBeDefined();
179
- expect((_a = error.response) === null || _a === void 0 ? void 0 : _a.status).toBe(400);
180
- expect(error.response.statusText).toBe("Bad Request");
181
- }
182
- }), 20000);
183
- test('Test8:should update a brand successfully', () => __awaiter(void 0, void 0, void 0, function* () {
184
- const brandName = "Node-SDK-Test";
185
- const brandLogo = fs.createReadStream("tests/documents/logo.jpg");
186
- const backgroundColor = "Blue";
187
- const buttonColor = "Black";
188
- const buttonTextColor = "White";
189
- const emailDisplayName = "divya.boopathy+12@syncfusion.com";
190
- try {
191
- const updateBrandApiResponse = yield brandingApi.editBrand(brandId, brandName, brandLogo, backgroundColor, buttonColor, buttonTextColor, emailDisplayName);
192
- console.log("Brand updated successfully:", updateBrandApiResponse.brandId);
193
- expect(updateBrandApiResponse).toBeDefined();
194
- }
195
- catch (error) {
196
- console.error("Error occurred while updating the brand:", error.message);
197
- throw new Error("API call failed");
198
- }
199
- }), 20000);
200
- test('Test9: should fail to update a brand with invalid logo path', () => __awaiter(void 0, void 0, void 0, function* () {
201
- var _a;
202
- const brandName = "Node-SDK-Test";
203
- try {
204
- const brandLogo = fs.createReadStream("tests/documents/agreement.pdf");
205
- yield brandingApi.editBrand(brandId, brandName, brandLogo);
206
- }
207
- catch (error) {
208
- console.error("Expected error while updating with invalid logo path:");
209
- expect(error.response).toBeDefined();
210
- expect((_a = error.response) === null || _a === void 0 ? void 0 : _a.status).toBe(400);
211
- expect(error.response.statusText).toBe("Bad Request");
212
- }
213
- }), 20000);
214
- test('Test10: should fail to update a brand with invalid brand ID', () => __awaiter(void 0, void 0, void 0, function* () {
215
- var _a;
216
- const brandName = "Node-SDK-Test";
217
- try {
218
- const invalidBrandId = "invalid-brand-id";
219
- const brandLogo = fs.createReadStream("tests/documents/logo.jpg");
220
- yield brandingApi.editBrand(invalidBrandId, brandName, brandLogo);
221
- throw new Error("API call should have failed due to invalid brand ID");
222
- }
223
- catch (error) {
224
- console.error("Expected error while updating with invalid brand ID:", error.message);
225
- expect(error.response).toBeDefined();
226
- expect((_a = error.response) === null || _a === void 0 ? void 0 : _a.status).toBe(400);
227
- expect(error.response.statusText).toBe("Bad Request");
228
- }
229
- }), 20000);
230
- test('Test11:should get brand details successfully', () => __awaiter(void 0, void 0, void 0, function* () {
231
- try {
232
- const brandDetailsResponse = yield brandingApi.getBrand(brandId);
233
- console.log("Brand details retrieved successfully:", brandDetailsResponse);
234
- expect(brandDetailsResponse).toBeDefined();
235
- expect(brandDetailsResponse.id).toBe(brandId);
236
- }
237
- catch (error) {
238
- console.log("Error occurred while calling the API:", error.message);
239
- }
240
- }), 20000);
241
- test('Test12:should fail to retrieve brand details with non-existent brand ID', () => __awaiter(void 0, void 0, void 0, function* () {
242
- const brandId = "INVALID_BRAND_ID";
243
- try {
244
- const brandDetailsResponse = yield brandingApi.getBrand(brandId);
245
- console.log("Brand details retrieved successfully:", brandDetailsResponse);
246
- expect(brandDetailsResponse).toBeUndefined();
247
- }
248
- catch (error) {
249
- console.error("Error occurred while calling the API:", error.message);
250
- expect(error.message).toBeDefined();
251
- }
252
- }), 20000);
253
- test('Test13:should retrieve the brand list successfully', () => __awaiter(void 0, void 0, void 0, function* () {
254
- try {
255
- const brandListResponse = yield brandingApi.brandList();
256
- console.log("Brand List:", brandListResponse);
257
- }
258
- catch (error) {
259
- console.error("Error occurred while calling the API:", error.message);
260
- throw new Error("API call failed");
261
- }
262
- }), 20000);
263
- test('Test14:should reset the default brand successfully', () => __awaiter(void 0, void 0, void 0, function* () {
264
- try {
265
- const response = yield brandingApi.resetDefaultBrand(brandId);
266
- console.log("Brand reset as default successfully:", response);
267
- expect(response).toBeDefined();
268
- }
269
- catch (error) {
270
- console.error("Error occurred while calling the API:", error.message);
271
- throw new Error("API call failed to reset default brand");
272
- }
273
- }), 30000);
274
- test('should fail to reset the default brand with non-existent brand ID', () => __awaiter(void 0, void 0, void 0, function* () {
275
- const brandId = "NON_EXISTENT_BRAND_ID";
276
- try {
277
- const response = yield brandingApi.resetDefaultBrand(brandId);
278
- console.log("Brand reset unexpectedly succeeded:", response);
279
- throw new Error("Test failed. API call should have failed with non-existent brand ID.");
280
- }
281
- catch (error) {
282
- console.error("Expected error occurred while calling the API:", error.message);
283
- }
284
- }), 20000);
285
- test('Tes16:should delete a brand successfully', () => __awaiter(void 0, void 0, void 0, function* () {
286
- try {
287
- const deleteResponse = yield brandingApi.deleteBrand(brandId);
288
- console.log("Brand deleted successfully:", deleteResponse);
289
- expect(deleteResponse).toBeDefined();
290
- expect(deleteResponse.success).toBe(true);
291
- }
292
- catch (error) {
293
- console.log("Error occurred while calling the API:", error.message);
294
- }
295
- }), 20000);
296
- test('Test17:should fail to delete a brand with invalid brand ID', () => __awaiter(void 0, void 0, void 0, function* () {
297
- const brandId = "invalid-brand-id";
298
- try {
299
- const deleteResponse = yield brandingApi.deleteBrand(brandId);
300
- console.log("Brand deleted unexpectedly:", deleteResponse);
301
- expect(deleteResponse).toBeDefined();
302
- expect(deleteResponse.success).toBe(false);
303
- }
304
- catch (error) {
305
- console.error("Error occurred while calling the API:", error.message);
306
- expect(error.message).toBeDefined();
307
- }
308
- }), 20000);
309
- });
310
- //# sourceMappingURL=BrandingApiTest.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BrandingApiTest.spec.js","sourceRoot":"","sources":["../../../tests/integration/BrandingApiTest.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAoD;AACpD,uDAA+B;AAC/B,uCAAyB;AAEzB,QAAQ,CAA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AAC;YACnB,OAAO,CAAC,GAAG,CAAC,uCAAuC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACtE,CAAC;IACH,CAAC,CAAA,EAAE,KAAK,CAAC,CAAC;IACV,IAAI,CAAC,4DAA4D,EAAE,GAAS,EAAE;QAC5E,MAAM,OAAO,GAAG,kBAAkB,CAAC;QACnC,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,MAAM,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAC9D,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,cAAc,CAAC,CAAC;YAC3D,MAAM,CAAC,cAAc,CAAC,CAAC,WAAW,EAAE,CAAC;YACrC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,KAAS,EAAE,CAAC;YACnB,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACtE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;QACtC,CAAC;IACH,CAAC,CAAA,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,249 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const contactsApi_1 = require("../../api/contactsApi");
16
- const model_1 = require("../../model");
17
- const config_1 = __importDefault(require("../config"));
18
- describe('Test suite', () => {
19
- let contactsApi;
20
- let contactId;
21
- let emailId;
22
- const generateRandomEmail = () => {
23
- const randomNum = Math.floor(1000 + Math.random() * 9000);
24
- return `sdktesting${randomNum}@syncfusion.com`;
25
- };
26
- beforeAll(() => {
27
- contactId = null;
28
- emailId = null;
29
- const apiKey = config_1.default.apiKey;
30
- const baseUrl = config_1.default.baseUrl;
31
- if (!baseUrl || !apiKey) {
32
- throw new Error("Environment variables 'HOST_URL' or 'API_KEY' are not set");
33
- }
34
- emailId = generateRandomEmail();
35
- contactsApi = new contactsApi_1.ContactsApi(baseUrl);
36
- contactsApi.setApiKey(apiKey);
37
- console.log(`Generated email: ${emailId}`);
38
- });
39
- test('Test1:should create a contact successfully', () => __awaiter(void 0, void 0, void 0, function* () {
40
- const contactDetails = new model_1.ContactDetails();
41
- contactDetails.name = "sdktesting";
42
- contactDetails.email = emailId;
43
- contactDetails.jobTitle = "HR";
44
- contactDetails.companyName = "Syncfusion";
45
- const phoneNumber = new model_1.PhoneNumber();
46
- phoneNumber.countryCode = "+91";
47
- phoneNumber.number = "6381261236";
48
- contactDetails.phoneNumber = phoneNumber;
49
- const contact = [contactDetails];
50
- try {
51
- const createContactResponse = yield contactsApi.createContact(contact);
52
- console.log("Contact created successfully:", createContactResponse.createdContacts);
53
- contactId = createContactResponse.createdContacts[0].id;
54
- console.log("Created Contact ID: ", contactId);
55
- }
56
- catch (error) {
57
- console.error("Error occurred while calling the API:", error.message);
58
- throw new Error("API call failed");
59
- }
60
- }), 20000);
61
- test('Test2:should create a contact successfully only with required fields', () => __awaiter(void 0, void 0, void 0, function* () {
62
- const contactDetails = new model_1.ContactDetails();
63
- contactDetails.name = "sdktesting";
64
- contactDetails.email = emailId + String(45);
65
- const contact = [contactDetails];
66
- try {
67
- const createContactResponse = yield contactsApi.createContact(contact);
68
- console.log("Contact created successfully:", createContactResponse.createdContacts);
69
- contactId = createContactResponse.createdContacts[0].id;
70
- console.log("Created Contact ID: ", contactId);
71
- expect(createContactResponse).toBeDefined();
72
- }
73
- catch (error) {
74
- console.error("Error occurred while calling the API:", error);
75
- expect(error).toBeUndefined();
76
- }
77
- }), 20000);
78
- test('Test3:should fail to create a contact with invalid email', () => __awaiter(void 0, void 0, void 0, function* () {
79
- const contactDetails = new model_1.ContactDetails();
80
- contactDetails.name = "sdktesting82";
81
- contactDetails.email = "invalid-email";
82
- contactDetails.jobTitle = "Developer";
83
- contactDetails.companyName = "CubeFlakes";
84
- const phoneNumber = new model_1.PhoneNumber();
85
- phoneNumber.countryCode = "+91";
86
- phoneNumber.number = "6381261236";
87
- contactDetails.phoneNumber = phoneNumber;
88
- const contact = [contactDetails];
89
- try {
90
- const createContactResponse = yield contactsApi.createContact(contact);
91
- console.log("Contacts created successfully:", createContactResponse.createdContacts);
92
- expect(createContactResponse.createdContacts).toBeUndefined();
93
- }
94
- catch (error) {
95
- console.error("Error occurred while calling the API:", error.message);
96
- expect(error.message).toBeDefined();
97
- }
98
- }), 20000);
99
- test('Test4:should update a contact successfully', () => __awaiter(void 0, void 0, void 0, function* () {
100
- const updatedContactDetails = new model_1.ContactDetails();
101
- updatedContactDetails.name = "Test_Engineer";
102
- updatedContactDetails.email = emailId;
103
- updatedContactDetails.jobTitle = "Tester";
104
- updatedContactDetails.companyName = "Flakes";
105
- const updatedPhoneNumber = new model_1.PhoneNumber();
106
- updatedPhoneNumber.countryCode = "+91";
107
- updatedPhoneNumber.number = "8807799764";
108
- updatedContactDetails.phoneNumber = updatedPhoneNumber;
109
- try {
110
- const updateContactResponse = yield contactsApi.updateContact(contactId, updatedContactDetails);
111
- console.log("Contact updated successfully:", updateContactResponse);
112
- expect(updateContactResponse).toBeDefined();
113
- }
114
- catch (error) {
115
- console.log("Error occurred while updating the contact:", error.message);
116
- }
117
- }), 20000);
118
- test('Test5:should fail to update contact due to missing required field (email)', () => __awaiter(void 0, void 0, void 0, function* () {
119
- const contactDetails = new model_1.ContactDetails();
120
- contactDetails.name = "TestEngineer";
121
- contactDetails.email = "";
122
- contactDetails.jobTitle = "Tester";
123
- contactDetails.companyName = "Flakes";
124
- const phoneNumber = new model_1.PhoneNumber();
125
- phoneNumber.countryCode = "+91";
126
- phoneNumber.number = "6381261236";
127
- contactDetails.phoneNumber = phoneNumber;
128
- try {
129
- const updateContactResponse = yield contactsApi.updateContact(contactId, contactDetails);
130
- console.log("Unexpected success:", updateContactResponse);
131
- expect(updateContactResponse).toBeDefined();
132
- }
133
- catch (error) {
134
- console.error("Error occurred while calling the API:", error.message);
135
- expect(error.message).toBeDefined();
136
- }
137
- }), 20000);
138
- test('Test6:should fail to update contact due to invalid contact ID', () => __awaiter(void 0, void 0, void 0, function* () {
139
- const contactDetails = new model_1.ContactDetails();
140
- contactDetails.name = "Test_Engineer";
141
- contactDetails.email = "test1705@gmail.com";
142
- contactDetails.jobTitle = "Tester";
143
- contactDetails.companyName = "Flakes";
144
- const phoneNumber = new model_1.PhoneNumber();
145
- phoneNumber.countryCode = "+91";
146
- phoneNumber.number = "6381261236";
147
- contactDetails.phoneNumber = phoneNumber;
148
- try {
149
- const updateContactResponse = yield contactsApi.updateContact("NON_EXISTENT_CONTACT_ID", contactDetails);
150
- console.log("Unexpected success:", updateContactResponse);
151
- expect(updateContactResponse).toBeDefined();
152
- }
153
- catch (error) {
154
- console.error("Error occurred while calling the API:", error.message);
155
- expect(error.message).toBeDefined();
156
- }
157
- }), 20000);
158
- test('Test7:should retrieve contact details successfully', () => __awaiter(void 0, void 0, void 0, function* () {
159
- try {
160
- const contactDetailsResponse = yield contactsApi.getContact(contactId);
161
- console.log("Contact details retrieved successfully:", contactDetailsResponse);
162
- expect(contactDetailsResponse).toBeDefined();
163
- expect(contactDetailsResponse.id).toBe(contactId);
164
- }
165
- catch (error) {
166
- console.error("Error occurred while calling the API:", error.message);
167
- throw new Error("API call failed");
168
- }
169
- }), 20000);
170
- test('Test8:should return error for invalid contact ID in get contact', () => __awaiter(void 0, void 0, void 0, function* () {
171
- const invalidContactId = "INVALID_CONTACT_ID";
172
- try {
173
- const contactDetailsResponse = yield contactsApi.getContact(invalidContactId);
174
- console.log("Unexpected success:", contactDetailsResponse);
175
- fail("API should not have succeeded with an invalid contact ID");
176
- }
177
- catch (error) {
178
- console.error("Expected error occurred while calling the API:", error.message);
179
- expect(error.message).toBeDefined();
180
- }
181
- }), 20000);
182
- test('Test9:should delete a contact successfully', () => __awaiter(void 0, void 0, void 0, function* () {
183
- try {
184
- const deleteResponse = yield contactsApi.deleteContacts(contactId);
185
- console.log("Contact deleted successfully:", deleteResponse);
186
- expect(deleteResponse).toBeDefined();
187
- expect(deleteResponse.success).toBe(true);
188
- }
189
- catch (error) {
190
- console.log("Error occurred while calling the API:", error.message);
191
- }
192
- }), 20000);
193
- test('Test10:should fail to delete a contact with an invalid contact ID', () => __awaiter(void 0, void 0, void 0, function* () {
194
- const invalidContactId = "INVALID_CONTACT_ID";
195
- try {
196
- const deleteResponse = yield contactsApi.deleteContacts(invalidContactId);
197
- console.error("Unexpected success response:", deleteResponse);
198
- throw new Error("Expected error, but the API call was successful.");
199
- }
200
- catch (error) {
201
- console.log("Error occurred as expected while calling the API:", error.message);
202
- expect(error.message).toBeDefined();
203
- }
204
- }), 20000);
205
- test('Test11:should retrieve contact list successfully', () => __awaiter(void 0, void 0, void 0, function* () {
206
- const page = 1;
207
- const pageSize = 10;
208
- try {
209
- const contactListResponse = yield contactsApi.contactUserList(page, pageSize);
210
- console.log("Contact list retrieved successfully:", contactListResponse);
211
- expect(contactListResponse).toBeDefined();
212
- expect(contactListResponse.contacts).toBeDefined();
213
- expect(contactListResponse.contacts.length).toBeGreaterThan(0);
214
- expect(contactListResponse.page).toBe(page);
215
- expect(contactListResponse.pageSize).toBe(pageSize);
216
- }
217
- catch (error) {
218
- console.log("Error occurred while calling the API:", error.message);
219
- }
220
- }), 20000);
221
- test('Test12:should fail to retrieve contact list with invalid page', () => __awaiter(void 0, void 0, void 0, function* () {
222
- const page = -1;
223
- const pageSize = 10;
224
- try {
225
- const contactListResponse = yield contactsApi.contactUserList(page, pageSize);
226
- console.log("Contact list retrieved unexpectedly:", contactListResponse);
227
- throw new Error("API call should have failed due to invalid pagination parameters");
228
- }
229
- catch (error) {
230
- console.error("Expected error occurred while calling the API:", error.message);
231
- expect(error.message).toBeDefined();
232
- }
233
- }), 20000);
234
- test('Test13:should fail to retrieve contact list with invalid page size', () => __awaiter(void 0, void 0, void 0, function* () {
235
- const page = 1;
236
- const pageSize = -10;
237
- try {
238
- const contactListResponse = yield contactsApi.contactUserList(page, pageSize);
239
- throw new Error("API call should have failed due to invalid pagination parameters");
240
- }
241
- catch (error) {
242
- console.error("Expected error occurred while calling the API:", error);
243
- expect(error).toBeDefined();
244
- expect(error.response).toBeDefined();
245
- expect(error.response.status).toBe(400);
246
- }
247
- }), 20000);
248
- });
249
- //# sourceMappingURL=ContactsApiTest.spec.js.map