@itentialopensource/adapter-jira 1.7.4 → 1.7.6

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 (183) hide show
  1. package/AUTH.md +39 -0
  2. package/BROKER.md +199 -0
  3. package/CALLS.md +9587 -0
  4. package/CHANGELOG.md +16 -0
  5. package/CODE_OF_CONDUCT.md +12 -17
  6. package/CONTRIBUTING.md +88 -74
  7. package/ENHANCE.md +69 -0
  8. package/PROPERTIES.md +641 -0
  9. package/README.md +225 -502
  10. package/SUMMARY.md +9 -0
  11. package/SYSTEMINFO.md +11 -0
  12. package/TROUBLESHOOT.md +47 -0
  13. package/adapter.js +10821 -59
  14. package/adapterBase.js +1030 -248
  15. package/entities/.generic/action.json +110 -5
  16. package/entities/.generic/schema.json +6 -1
  17. package/entities/Avatars/action.json +63 -0
  18. package/entities/Avatars/schema.json +4 -1
  19. package/entities/Dashboards/action.json +80 -0
  20. package/entities/Dashboards/mockdatafiles/copyDashboard-default.json +13 -0
  21. package/entities/Dashboards/mockdatafiles/createDashboard-default.json +13 -0
  22. package/entities/Dashboards/mockdatafiles/updateDashboard-default.json +13 -0
  23. package/entities/Dashboards/schema.json +5 -1
  24. package/entities/Groups/action.json +21 -0
  25. package/entities/Groups/mockdatafiles/bulkGetGroups-default.json +16 -0
  26. package/entities/Groups/schema.json +2 -1
  27. package/entities/InstanceInformation/action.json +25 -0
  28. package/entities/InstanceInformation/mockdatafiles/getLicense-default.json +20 -0
  29. package/entities/InstanceInformation/schema.json +19 -0
  30. package/entities/IssueCustomFieldConfigurationApps/action.json +45 -0
  31. package/entities/IssueCustomFieldConfigurationApps/mockdatafiles/getCustomFieldConfiguration-default.json +34 -0
  32. package/entities/IssueCustomFieldConfigurationApps/schema.json +20 -0
  33. package/entities/IssueCustomFieldContexts/action.json +268 -0
  34. package/entities/IssueCustomFieldContexts/mockdatafiles/createCustomFieldContext-default.json +9 -0
  35. package/entities/IssueCustomFieldContexts/mockdatafiles/getContextsForField-default.json +22 -0
  36. package/entities/IssueCustomFieldContexts/mockdatafiles/getCustomFieldContextsForProjectsAndIssueTypes-default.json +23 -0
  37. package/entities/IssueCustomFieldContexts/mockdatafiles/getDefaultValues-default.json +22 -0
  38. package/entities/IssueCustomFieldContexts/mockdatafiles/getIssueTypeMappingsForContexts-default.json +20 -0
  39. package/entities/IssueCustomFieldContexts/mockdatafiles/getProjectContextMapping-default.json +16 -0
  40. package/entities/IssueCustomFieldContexts/schema.json +31 -0
  41. package/entities/IssueCustomFieldOptions/action.json +105 -0
  42. package/entities/IssueCustomFieldOptions/mockdatafiles/createCustomFieldOption-default.json +20 -0
  43. package/entities/IssueCustomFieldOptions/mockdatafiles/getOptionsForContext-default.json +26 -0
  44. package/entities/IssueCustomFieldOptions/mockdatafiles/updateCustomFieldOption-default.json +19 -0
  45. package/entities/IssueCustomFieldOptions/schema.json +23 -0
  46. package/entities/IssueCustomFieldValuesApps/action.json +44 -0
  47. package/entities/IssueCustomFieldValuesApps/schema.json +20 -0
  48. package/entities/IssueFieldConfigurations/action.json +309 -0
  49. package/entities/IssueFieldConfigurations/mockdatafiles/createFieldConfiguration-default.json +5 -0
  50. package/entities/IssueFieldConfigurations/mockdatafiles/createFieldConfigurationScheme-default.json +5 -0
  51. package/entities/IssueFieldConfigurations/mockdatafiles/getAllFieldConfigurationSchemes-default.json +23 -0
  52. package/entities/IssueFieldConfigurations/mockdatafiles/getAllFieldConfigurations-default.json +19 -0
  53. package/entities/IssueFieldConfigurations/mockdatafiles/getFieldConfigurationItems-default.json +19 -0
  54. package/entities/IssueFieldConfigurations/mockdatafiles/getFieldConfigurationSchemeMappings-default.json +33 -0
  55. package/entities/IssueFieldConfigurations/mockdatafiles/getFieldConfigurationSchemeProjectMapping-default.json +26 -0
  56. package/entities/IssueFieldConfigurations/schema.json +33 -0
  57. package/entities/IssueTypeSchemes/action.json +207 -0
  58. package/entities/IssueTypeSchemes/mockdatafiles/createIssueTypeScheme-default.json +3 -0
  59. package/entities/IssueTypeSchemes/mockdatafiles/getAllIssueTypeSchemes-default.json +26 -0
  60. package/entities/IssueTypeSchemes/mockdatafiles/getIssueTypeSchemeForProjects-default.json +44 -0
  61. package/entities/IssueTypeSchemes/mockdatafiles/getIssueTypeSchemesMapping-default.json +24 -0
  62. package/entities/IssueTypeSchemes/schema.json +28 -0
  63. package/entities/IssueTypeScreenSchemes/action.json +228 -0
  64. package/entities/IssueTypeScreenSchemes/mockdatafiles/createIssueTypeScreenScheme-default.json +3 -0
  65. package/entities/IssueTypeScreenSchemes/mockdatafiles/getIssueTypeScreenSchemeMappings-default.json +28 -0
  66. package/entities/IssueTypeScreenSchemes/mockdatafiles/getIssueTypeScreenSchemeProjectAssociations-default.json +19 -0
  67. package/entities/IssueTypeScreenSchemes/mockdatafiles/getIssueTypeScreenSchemes-default.json +18 -0
  68. package/entities/IssueTypeScreenSchemes/mockdatafiles/getProjectsForIssueTypeScreenScheme-default.json +27 -0
  69. package/entities/IssueTypeScreenSchemes/schema.json +29 -0
  70. package/entities/Issueattachments/action.json +42 -0
  71. package/entities/Issueattachments/schema.json +3 -1
  72. package/entities/Issuefields/action.json +122 -0
  73. package/entities/Issuefields/mockdatafiles/getContextsForFieldDeprecated-default.json +12 -0
  74. package/entities/Issuefields/mockdatafiles/getFieldsPaginated-default.json +46 -0
  75. package/entities/Issuefields/schema.json +7 -1
  76. package/entities/Issueproperties/action.json +40 -0
  77. package/entities/Issueproperties/schema.json +3 -1
  78. package/entities/Issues/action.json +45 -0
  79. package/entities/Issues/mockdatafiles/getChangeLogsByIds-default.json +65 -0
  80. package/entities/Issues/mockdatafiles/getEvents-default.json +10 -0
  81. package/entities/Issues/schema.json +20 -0
  82. package/entities/Issuesearch/action.json +20 -0
  83. package/entities/Issuesearch/mockdatafiles/matchIssues-default.json +29 -0
  84. package/entities/Issuesearch/schema.json +2 -1
  85. package/entities/Issuesecuritylevel/action.json +21 -0
  86. package/entities/Issuesecuritylevel/mockdatafiles/getIssueSecurityLevelMembers-default.json +46 -0
  87. package/entities/Issuesecuritylevel/schema.json +2 -1
  88. package/entities/Issuetypes/action.json +21 -0
  89. package/entities/Issuetypes/mockdatafiles/getIssueTypesForProject-default.json +39 -0
  90. package/entities/Issuetypes/schema.json +2 -1
  91. package/entities/Issuewatchers/action.json +20 -0
  92. package/entities/Issuewatchers/mockdatafiles/getIsWatchingIssueBulk-default.json +7 -0
  93. package/entities/Issuewatchers/schema.json +2 -1
  94. package/entities/JQL/action.json +40 -0
  95. package/entities/JQL/mockdatafiles/getAutoCompletePost-default.json +89 -0
  96. package/entities/JQL/mockdatafiles/parseJqlQueries-default.json +119 -0
  97. package/entities/JQL/schema.json +3 -1
  98. package/entities/Jiraexpressions/action.json +20 -0
  99. package/entities/Jiraexpressions/mockdatafiles/analyseExpression-default.json +47 -0
  100. package/entities/Jiraexpressions/schema.json +2 -1
  101. package/entities/Labels/action.json +25 -0
  102. package/entities/Labels/mockdatafiles/getAllLabels-default.json +10 -0
  103. package/entities/Labels/schema.json +19 -0
  104. package/entities/ProjectEmail/action.json +45 -0
  105. package/entities/ProjectEmail/mockdatafiles/getProjectEmail-default.json +6 -0
  106. package/entities/ProjectEmail/schema.json +20 -0
  107. package/entities/ProjectFeatures/action.json +45 -0
  108. package/entities/ProjectFeatures/mockdatafiles/getFeaturesForProject-default.json +24 -0
  109. package/entities/ProjectFeatures/mockdatafiles/toggleFeatureForProject-default.json +24 -0
  110. package/entities/ProjectFeatures/schema.json +20 -0
  111. package/entities/Projects/action.json +102 -0
  112. package/entities/Projects/mockdatafiles/getHierarchy-default.json +50 -0
  113. package/entities/Projects/mockdatafiles/getRecent-default.json +50 -0
  114. package/entities/Projects/mockdatafiles/restore-default.json +139 -0
  115. package/entities/Projects/schema.json +6 -1
  116. package/entities/Projecttypes/action.json +21 -0
  117. package/entities/Projecttypes/mockdatafiles/getAllAccessibleProjectTypes-default.json +16 -0
  118. package/entities/Projecttypes/schema.json +2 -1
  119. package/entities/ScreenSchemes/action.json +85 -0
  120. package/entities/ScreenSchemes/mockdatafiles/createScreenScheme-default.json +3 -0
  121. package/entities/ScreenSchemes/mockdatafiles/getScreenSchemes-default.json +28 -0
  122. package/entities/ScreenSchemes/schema.json +22 -0
  123. package/entities/Screens/action.json +81 -0
  124. package/entities/Screens/mockdatafiles/createScreen-default.json +5 -0
  125. package/entities/Screens/mockdatafiles/getScreensForField-default.json +17 -0
  126. package/entities/Screens/mockdatafiles/updateScreen-default.json +5 -0
  127. package/entities/Screens/schema.json +5 -1
  128. package/entities/Users/action.json +84 -0
  129. package/entities/Users/mockdatafiles/getAllUsers-default.json +32 -0
  130. package/entities/Users/mockdatafiles/getAllUsersDefault-default.json +32 -0
  131. package/entities/Users/mockdatafiles/getUserEmail-default.json +1 -0
  132. package/entities/Users/schema.json +5 -1
  133. package/entities/Webhooks/action.json +106 -0
  134. package/entities/Webhooks/mockdatafiles/getDynamicWebhooksForApp-default.json +40 -0
  135. package/entities/Webhooks/mockdatafiles/getFailedWebhooks-default.json +17 -0
  136. package/entities/Webhooks/mockdatafiles/refreshWebhooks-default.json +3 -0
  137. package/entities/Webhooks/mockdatafiles/registerDynamicWebhooks-default.json +15 -0
  138. package/entities/Webhooks/schema.json +23 -0
  139. package/entities/WorkflowSchemeProjectAssociations/action.json +45 -0
  140. package/entities/WorkflowSchemeProjectAssociations/mockdatafiles/getWorkflowSchemeProjectAssociations-default.json +21 -0
  141. package/entities/WorkflowSchemeProjectAssociations/schema.json +20 -0
  142. package/entities/WorkflowTransitionRules/action.json +65 -0
  143. package/entities/WorkflowTransitionRules/mockdatafiles/deleteWorkflowTransitionRuleConfigurations-default.json +34 -0
  144. package/entities/WorkflowTransitionRules/mockdatafiles/getWorkflowTransitionRuleConfigurations-default.json +56 -0
  145. package/entities/WorkflowTransitionRules/mockdatafiles/updateWorkflowTransitionRuleConfigurations-default.json +34 -0
  146. package/entities/WorkflowTransitionRules/schema.json +21 -0
  147. package/entities/Workflows/action.json +61 -0
  148. package/entities/Workflows/mockdatafiles/createWorkflow-default.json +4 -0
  149. package/entities/Workflows/mockdatafiles/getWorkflowsPaginated-default.json +140 -0
  150. package/entities/Workflows/schema.json +4 -1
  151. package/entities/Workflowschemedrafts/action.json +20 -0
  152. package/entities/Workflowschemedrafts/schema.json +2 -1
  153. package/entities/Workflowschemes/action.json +21 -0
  154. package/entities/Workflowschemes/mockdatafiles/getAllWorkflowSchemes-default.json +30 -0
  155. package/entities/Workflowschemes/schema.json +2 -1
  156. package/error.json +12 -0
  157. package/package.json +21 -13
  158. package/pronghorn.json +33339 -5948
  159. package/propertiesDecorators.json +14 -0
  160. package/propertiesSchema.json +436 -0
  161. package/refs?service=git-upload-pack +0 -0
  162. package/report/adapterInfo.json +10 -0
  163. package/report/updateReport1659707107792.json +120 -0
  164. package/sampleProperties.json +95 -3
  165. package/test/integration/adapterTestBasicGet.js +2 -2
  166. package/test/integration/adapterTestIntegration.js +3633 -106
  167. package/test/unit/adapterBaseTestUnit.js +35 -27
  168. package/test/unit/adapterTestUnit.js +4767 -115
  169. package/utils/adapterInfo.js +206 -0
  170. package/utils/addAuth.js +94 -0
  171. package/utils/basicGet.js +1 -14
  172. package/utils/entitiesToDB.js +179 -0
  173. package/utils/methodDocumentor.js +225 -0
  174. package/utils/modify.js +1 -1
  175. package/utils/packModificationScript.js +1 -1
  176. package/utils/patches2bundledDeps.js +90 -0
  177. package/utils/pre-commit.sh +5 -0
  178. package/utils/removeHooks.js +20 -0
  179. package/utils/tbScript.js +43 -22
  180. package/utils/tbUtils.js +126 -29
  181. package/utils/testRunner.js +16 -16
  182. package/utils/troubleshootingAdapter.js +2 -26
  183. package/versions.json +142 -0
@@ -1,8 +1,10 @@
1
1
  /* @copyright Itential, LLC 2019 (pre-modifications) */
2
2
 
3
3
  // Set globals
4
- /* global describe it log pronghornProps before after */
4
+ /* global after before describe it log pronghornProps */
5
5
  /* eslint no-unused-vars: warn */
6
+ /* eslint no-underscore-dangle: warn */
7
+ /* eslint import/no-dynamic-require:warn */
6
8
 
7
9
  // include required items for testing & logging
8
10
  const assert = require('assert');
@@ -13,25 +15,39 @@ const winston = require('winston');
13
15
  const { expect } = require('chai');
14
16
  const { use } = require('chai');
15
17
  const td = require('testdouble');
18
+ const util = require('util');
16
19
 
17
20
  const anything = td.matchers.anything();
18
21
 
19
22
  // stub and attemptTimeout are used throughout the code so set them here
20
23
  let logLevel = 'none';
21
- const stub = true;
22
24
  const isRapidFail = false;
23
25
  const isSaveMockData = false;
24
- const attemptTimeout = 5000;
26
+
27
+ // read in the properties from the sampleProperties files
28
+ let adaptdir = __dirname;
29
+ if (adaptdir.endsWith('/test/integration')) {
30
+ adaptdir = adaptdir.substring(0, adaptdir.length - 17);
31
+ } else if (adaptdir.endsWith('/test/unit')) {
32
+ adaptdir = adaptdir.substring(0, adaptdir.length - 10);
33
+ }
34
+ const samProps = require(`${adaptdir}/sampleProperties.json`).properties;
25
35
 
26
36
  // these variables can be changed to run in integrated mode so easier to set them here
27
37
  // always check these in with bogus data!!!
28
- const host = 'replace.hostorip.here';
29
- const username = 'username';
30
- const password = 'password';
31
- const protocol = 'http';
32
- const port = 80;
33
- const sslenable = false;
34
- const sslinvalid = false;
38
+ samProps.stub = true;
39
+ samProps.host = 'replace.hostorip.here';
40
+ samProps.authentication.username = 'username';
41
+ samProps.authentication.password = 'password';
42
+ samProps.protocol = 'http';
43
+ samProps.port = 80;
44
+ samProps.ssl.enabled = false;
45
+ samProps.ssl.accept_invalid_cert = false;
46
+ if (samProps.request.attempt_timeout < 30000) {
47
+ samProps.request.attempt_timeout = 30000;
48
+ }
49
+ const attemptTimeout = samProps.request.attempt_timeout;
50
+ const { stub } = samProps;
35
51
 
36
52
  // these are the adapter properties. You generally should not need to alter
37
53
  // any of these after they are initially set up
@@ -43,99 +59,7 @@ global.pronghornProps = {
43
59
  adapters: [{
44
60
  id: 'Test-jira',
45
61
  type: 'Jira',
46
- properties: {
47
- host,
48
- port,
49
- version: '',
50
- base_path: '',
51
- cache_location: 'none',
52
- encode_pathvars: true,
53
- save_metric: false,
54
- stub,
55
- protocol,
56
- authentication: {
57
- auth_method: 'basic user_password',
58
- username,
59
- password,
60
- token: 'YOUR PERSONAL ACCESS TOKEN',
61
- token_timeout: -1,
62
- token_cache: 'local',
63
- invalid_token_error: 401,
64
- auth_field: 'header.headers.Authorization',
65
- auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
66
- auth_logging: false
67
- },
68
- healthcheck: {
69
- type: 'startup',
70
- frequency: 300000,
71
- query_object: {}
72
- },
73
- throttle: {
74
- throttle_enabled: false,
75
- number_pronghorns: 1,
76
- sync_async: 'sync',
77
- max_in_queue: 1000,
78
- concurrent_max: 1,
79
- expire_timeout: 0,
80
- avg_runtime: 200,
81
- priorities: [
82
- {
83
- value: 0,
84
- percent: 100
85
- }
86
- ]
87
- },
88
- request: {
89
- number_redirects: 0,
90
- number_retries: 3,
91
- limit_retry_error: 0,
92
- failover_codes: [],
93
- attempt_timeout: attemptTimeout,
94
- global_request: {
95
- payload: {},
96
- uriOptions: {},
97
- addlHeaders: {},
98
- authData: {}
99
- },
100
- healthcheck_on_timeout: true,
101
- return_raw: true,
102
- archiving: false,
103
- return_request: false
104
- },
105
- proxy: {
106
- enabled: false,
107
- host: '',
108
- port: 1,
109
- protocol: 'http',
110
- username: '',
111
- password: ''
112
- },
113
- ssl: {
114
- ecdhCurve: '',
115
- enabled: sslenable,
116
- accept_invalid_cert: sslinvalid,
117
- ca_file: '',
118
- key_file: '',
119
- cert_file: '',
120
- secure_protocol: '',
121
- ciphers: ''
122
- },
123
- mongo: {
124
- host: '',
125
- port: 0,
126
- database: '',
127
- username,
128
- password: '',
129
- replSet: '',
130
- db_ssl: {
131
- enabled: false,
132
- accept_invalid_cert: false,
133
- ca_file: '',
134
- key_file: '',
135
- cert_file: ''
136
- }
137
- }
138
- }
62
+ properties: samProps
139
63
  }]
140
64
  }
141
65
  };
@@ -310,12 +234,12 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
310
234
  }
311
235
 
312
236
  // require the adapter that we are going to be using
313
- const Jira2 = require('../../adapter.js');
237
+ const Jira = require('../../adapter');
314
238
 
315
239
  // begin the testing - these should be pretty well defined between the describe and the it!
316
240
  describe('[integration] Jira Adapter Test', () => {
317
- describe('Jira2 Class Tests', () => {
318
- const a = new Jira2(
241
+ describe('Jira Class Tests', () => {
242
+ const a = new Jira(
319
243
  pronghornProps.adapterProps.adapters[0].id,
320
244
  pronghornProps.adapterProps.adapters[0].properties
321
245
  );
@@ -341,6 +265,8 @@ describe('[integration] Jira Adapter Test', () => {
341
265
  try {
342
266
  assert.notEqual(null, a);
343
267
  assert.notEqual(undefined, a);
268
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
269
+ assert.equal(checkId, a.id);
344
270
  assert.notEqual(null, a.allProps);
345
271
  const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
346
272
  assert.equal(check, a.healthcheckType);
@@ -12150,5 +12076,3606 @@ describe('[integration] Jira Adapter Test', () => {
12150
12076
  }
12151
12077
  }).timeout(attemptTimeout);
12152
12078
  });
12079
+
12080
+ const issueCustomFieldValuesAppsUpdateMultipleCustomFieldValuesBodyParam = {
12081
+ updates: [
12082
+ {
12083
+ customField: 'string',
12084
+ issueIds: [
12085
+ 4
12086
+ ],
12087
+ value: null
12088
+ }
12089
+ ]
12090
+ };
12091
+ describe('#updateMultipleCustomFieldValues - errors', () => {
12092
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12093
+ try {
12094
+ a.updateMultipleCustomFieldValues(null, issueCustomFieldValuesAppsUpdateMultipleCustomFieldValuesBodyParam, (data, error) => {
12095
+ try {
12096
+ if (stub) {
12097
+ const displayE = 'Error 400 received on request';
12098
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12099
+ } else {
12100
+ runCommonAsserts(data, error);
12101
+ }
12102
+ saveMockData('IssueCustomFieldValuesApps', 'updateMultipleCustomFieldValues', 'default', data);
12103
+ done();
12104
+ } catch (err) {
12105
+ log.error(`Test Failure: ${err}`);
12106
+ done(err);
12107
+ }
12108
+ });
12109
+ } catch (error) {
12110
+ log.error(`Adapter Exception: ${error}`);
12111
+ done(error);
12112
+ }
12113
+ }).timeout(attemptTimeout);
12114
+ });
12115
+
12116
+ const issueCustomFieldValuesAppsUpdateCustomFieldValueBodyParam = {
12117
+ updates: [
12118
+ {
12119
+ issueIds: [
12120
+ 9
12121
+ ],
12122
+ value: null
12123
+ }
12124
+ ]
12125
+ };
12126
+ describe('#updateCustomFieldValue - errors', () => {
12127
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12128
+ try {
12129
+ a.updateCustomFieldValue('fakedata', null, issueCustomFieldValuesAppsUpdateCustomFieldValueBodyParam, (data, error) => {
12130
+ try {
12131
+ if (stub) {
12132
+ const displayE = 'Error 400 received on request';
12133
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12134
+ } else {
12135
+ runCommonAsserts(data, error);
12136
+ }
12137
+ saveMockData('IssueCustomFieldValuesApps', 'updateCustomFieldValue', 'default', data);
12138
+ done();
12139
+ } catch (err) {
12140
+ log.error(`Test Failure: ${err}`);
12141
+ done(err);
12142
+ }
12143
+ });
12144
+ } catch (error) {
12145
+ log.error(`Adapter Exception: ${error}`);
12146
+ done(error);
12147
+ }
12148
+ }).timeout(attemptTimeout);
12149
+ });
12150
+
12151
+ describe('#getCustomFieldConfiguration - errors', () => {
12152
+ it('should work if integrated or standalone with mockdata', (done) => {
12153
+ try {
12154
+ a.getCustomFieldConfiguration('fakedata', null, null, null, null, null, null, null, null, (data, error) => {
12155
+ try {
12156
+ if (stub) {
12157
+ runCommonAsserts(data, error);
12158
+ assert.equal(1000, data.response.maxResults);
12159
+ assert.equal(0, data.response.startAt);
12160
+ assert.equal(2, data.response.total);
12161
+ assert.equal(true, data.response.isLast);
12162
+ assert.equal(true, Array.isArray(data.response.values));
12163
+ } else {
12164
+ runCommonAsserts(data, error);
12165
+ }
12166
+ saveMockData('IssueCustomFieldConfigurationApps', 'getCustomFieldConfiguration', 'default', data);
12167
+ done();
12168
+ } catch (err) {
12169
+ log.error(`Test Failure: ${err}`);
12170
+ done(err);
12171
+ }
12172
+ });
12173
+ } catch (error) {
12174
+ log.error(`Adapter Exception: ${error}`);
12175
+ done(error);
12176
+ }
12177
+ }).timeout(attemptTimeout);
12178
+ });
12179
+
12180
+ const issueCustomFieldConfigurationAppsUpdateCustomFieldConfigurationBodyParam = {
12181
+ configurations: [
12182
+ {}
12183
+ ]
12184
+ };
12185
+ describe('#updateCustomFieldConfiguration - errors', () => {
12186
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12187
+ try {
12188
+ a.updateCustomFieldConfiguration('fakedata', issueCustomFieldConfigurationAppsUpdateCustomFieldConfigurationBodyParam, (data, error) => {
12189
+ try {
12190
+ if (stub) {
12191
+ const displayE = 'Error 400 received on request';
12192
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12193
+ } else {
12194
+ runCommonAsserts(data, error);
12195
+ }
12196
+ saveMockData('IssueCustomFieldConfigurationApps', 'updateCustomFieldConfiguration', 'default', data);
12197
+ done();
12198
+ } catch (err) {
12199
+ log.error(`Test Failure: ${err}`);
12200
+ done(err);
12201
+ }
12202
+ });
12203
+ } catch (error) {
12204
+ log.error(`Adapter Exception: ${error}`);
12205
+ done(error);
12206
+ }
12207
+ }).timeout(attemptTimeout);
12208
+ });
12209
+
12210
+ describe('#getAttachmentContent - errors', () => {
12211
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12212
+ try {
12213
+ a.getAttachmentContent('fakedata', null, (data, error) => {
12214
+ try {
12215
+ if (stub) {
12216
+ const displayE = 'Error 400 received on request';
12217
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12218
+ } else {
12219
+ runCommonAsserts(data, error);
12220
+ }
12221
+ saveMockData('IssueAttachments', 'getAttachmentContent', 'default', data);
12222
+ done();
12223
+ } catch (err) {
12224
+ log.error(`Test Failure: ${err}`);
12225
+ done(err);
12226
+ }
12227
+ });
12228
+ } catch (error) {
12229
+ log.error(`Adapter Exception: ${error}`);
12230
+ done(error);
12231
+ }
12232
+ }).timeout(attemptTimeout);
12233
+ });
12234
+
12235
+ describe('#getAttachmentThumbnail - errors', () => {
12236
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12237
+ try {
12238
+ a.getAttachmentThumbnail('fakedata', null, null, null, null, (data, error) => {
12239
+ try {
12240
+ if (stub) {
12241
+ const displayE = 'Error 400 received on request';
12242
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12243
+ } else {
12244
+ runCommonAsserts(data, error);
12245
+ }
12246
+ saveMockData('IssueAttachments', 'getAttachmentThumbnail', 'default', data);
12247
+ done();
12248
+ } catch (err) {
12249
+ log.error(`Test Failure: ${err}`);
12250
+ done(err);
12251
+ }
12252
+ });
12253
+ } catch (error) {
12254
+ log.error(`Adapter Exception: ${error}`);
12255
+ done(error);
12256
+ }
12257
+ }).timeout(attemptTimeout);
12258
+ });
12259
+
12260
+ const dashboardsCreateDashboardBodyParam = {
12261
+ name: 'string',
12262
+ sharePermissions: [
12263
+ {}
12264
+ ],
12265
+ editPermissions: [
12266
+ {}
12267
+ ]
12268
+ };
12269
+ describe('#createDashboard - errors', () => {
12270
+ it('should work if integrated or standalone with mockdata', (done) => {
12271
+ try {
12272
+ a.createDashboard(dashboardsCreateDashboardBodyParam, (data, error) => {
12273
+ try {
12274
+ if (stub) {
12275
+ runCommonAsserts(data, error);
12276
+ assert.equal('10000', data.response.id);
12277
+ assert.equal(false, data.response.isFavourite);
12278
+ assert.equal('System Dashboard', data.response.name);
12279
+ assert.equal(1, data.response.popularity);
12280
+ assert.equal('https://your-domain.atlassian.net/rest/api/3/dashboard/10000', data.response.self);
12281
+ assert.equal(true, Array.isArray(data.response.sharePermissions));
12282
+ assert.equal('https://your-domain.atlassian.net/secure/Dashboard.jspa?selectPageId=10000', data.response.view);
12283
+ } else {
12284
+ runCommonAsserts(data, error);
12285
+ }
12286
+ saveMockData('Dashboards', 'createDashboard', 'default', data);
12287
+ done();
12288
+ } catch (err) {
12289
+ log.error(`Test Failure: ${err}`);
12290
+ done(err);
12291
+ }
12292
+ });
12293
+ } catch (error) {
12294
+ log.error(`Adapter Exception: ${error}`);
12295
+ done(error);
12296
+ }
12297
+ }).timeout(attemptTimeout);
12298
+ });
12299
+
12300
+ const dashboardsUpdateDashboardBodyParam = {
12301
+ name: 'string',
12302
+ sharePermissions: [
12303
+ {}
12304
+ ],
12305
+ editPermissions: [
12306
+ {}
12307
+ ]
12308
+ };
12309
+ describe('#updateDashboard - errors', () => {
12310
+ it('should work if integrated or standalone with mockdata', (done) => {
12311
+ try {
12312
+ a.updateDashboard('fakedata', dashboardsUpdateDashboardBodyParam, (data, error) => {
12313
+ try {
12314
+ if (stub) {
12315
+ runCommonAsserts(data, error);
12316
+ assert.equal('success', data.response);
12317
+ } else {
12318
+ runCommonAsserts(data, error);
12319
+ }
12320
+ saveMockData('Dashboards', 'updateDashboard', 'default', data);
12321
+ done();
12322
+ } catch (err) {
12323
+ log.error(`Test Failure: ${err}`);
12324
+ done(err);
12325
+ }
12326
+ });
12327
+ } catch (error) {
12328
+ log.error(`Adapter Exception: ${error}`);
12329
+ done(error);
12330
+ }
12331
+ }).timeout(attemptTimeout);
12332
+ });
12333
+
12334
+ describe('#deleteDashboard - errors', () => {
12335
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12336
+ try {
12337
+ a.deleteDashboard('fakedata', (data, error) => {
12338
+ try {
12339
+ if (stub) {
12340
+ const displayE = 'Error 400 received on request';
12341
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12342
+ } else {
12343
+ runCommonAsserts(data, error);
12344
+ }
12345
+ saveMockData('Dashboards', 'deleteDashboard', 'default', data);
12346
+ done();
12347
+ } catch (err) {
12348
+ log.error(`Test Failure: ${err}`);
12349
+ done(err);
12350
+ }
12351
+ });
12352
+ } catch (error) {
12353
+ log.error(`Adapter Exception: ${error}`);
12354
+ done(error);
12355
+ }
12356
+ }).timeout(attemptTimeout);
12357
+ });
12358
+
12359
+ const dashboardsCopyDashboardBodyParam = {
12360
+ name: 'string',
12361
+ sharePermissions: [
12362
+ {}
12363
+ ],
12364
+ editPermissions: [
12365
+ {}
12366
+ ]
12367
+ };
12368
+ describe('#copyDashboard - errors', () => {
12369
+ it('should work if integrated or standalone with mockdata', (done) => {
12370
+ try {
12371
+ a.copyDashboard('fakedata', dashboardsCopyDashboardBodyParam, (data, error) => {
12372
+ try {
12373
+ if (stub) {
12374
+ runCommonAsserts(data, error);
12375
+ assert.equal('10000', data.response.id);
12376
+ assert.equal(false, data.response.isFavourite);
12377
+ assert.equal('System Dashboard', data.response.name);
12378
+ assert.equal(1, data.response.popularity);
12379
+ assert.equal('https://your-domain.atlassian.net/rest/api/3/dashboard/10000', data.response.self);
12380
+ assert.equal(true, Array.isArray(data.response.sharePermissions));
12381
+ assert.equal('https://your-domain.atlassian.net/secure/Dashboard.jspa?selectPageId=10000', data.response.view);
12382
+ } else {
12383
+ runCommonAsserts(data, error);
12384
+ }
12385
+ saveMockData('Dashboards', 'copyDashboard', 'default', data);
12386
+ done();
12387
+ } catch (err) {
12388
+ log.error(`Test Failure: ${err}`);
12389
+ done(err);
12390
+ }
12391
+ });
12392
+ } catch (error) {
12393
+ log.error(`Adapter Exception: ${error}`);
12394
+ done(error);
12395
+ }
12396
+ }).timeout(attemptTimeout);
12397
+ });
12398
+
12399
+ describe('#getEvents - errors', () => {
12400
+ it('should work if integrated or standalone with mockdata', (done) => {
12401
+ try {
12402
+ a.getEvents((data, error) => {
12403
+ try {
12404
+ if (stub) {
12405
+ runCommonAsserts(data, error);
12406
+ assert.equal('object', typeof data.response[0]);
12407
+ assert.equal('object', typeof data.response[1]);
12408
+ } else {
12409
+ runCommonAsserts(data, error);
12410
+ }
12411
+ saveMockData('Issues', 'getEvents', 'default', data);
12412
+ done();
12413
+ } catch (err) {
12414
+ log.error(`Test Failure: ${err}`);
12415
+ done(err);
12416
+ }
12417
+ });
12418
+ } catch (error) {
12419
+ log.error(`Adapter Exception: ${error}`);
12420
+ done(error);
12421
+ }
12422
+ }).timeout(attemptTimeout);
12423
+ });
12424
+
12425
+ const issuesGetChangeLogsByIdsBodyParam = {
12426
+ changelogIds: [
12427
+ 7
12428
+ ]
12429
+ };
12430
+ describe('#getChangeLogsByIds - errors', () => {
12431
+ it('should work if integrated or standalone with mockdata', (done) => {
12432
+ try {
12433
+ a.getChangeLogsByIds('fakedata', issuesGetChangeLogsByIdsBodyParam, (data, error) => {
12434
+ try {
12435
+ if (stub) {
12436
+ runCommonAsserts(data, error);
12437
+ assert.equal(0, data.response.startAt);
12438
+ assert.equal(2, data.response.maxResults);
12439
+ assert.equal(2, data.response.total);
12440
+ assert.equal(true, Array.isArray(data.response.histories));
12441
+ } else {
12442
+ runCommonAsserts(data, error);
12443
+ }
12444
+ saveMockData('Issues', 'getChangeLogsByIds', 'default', data);
12445
+ done();
12446
+ } catch (err) {
12447
+ log.error(`Test Failure: ${err}`);
12448
+ done(err);
12449
+ }
12450
+ });
12451
+ } catch (error) {
12452
+ log.error(`Adapter Exception: ${error}`);
12453
+ done(error);
12454
+ }
12455
+ }).timeout(attemptTimeout);
12456
+ });
12457
+
12458
+ const jiraExpressionsAnalyseExpressionBodyParam = {
12459
+ expressions: 'issues.map(issue => issue.properties[\'property_key\'])'
12460
+ };
12461
+ describe('#analyseExpression - errors', () => {
12462
+ it('should work if integrated or standalone with mockdata', (done) => {
12463
+ try {
12464
+ a.analyseExpression(null, jiraExpressionsAnalyseExpressionBodyParam, (data, error) => {
12465
+ try {
12466
+ if (stub) {
12467
+ runCommonAsserts(data, error);
12468
+ assert.equal(true, Array.isArray(data.response.results));
12469
+ } else {
12470
+ runCommonAsserts(data, error);
12471
+ }
12472
+ saveMockData('JiraExpressions', 'analyseExpression', 'default', data);
12473
+ done();
12474
+ } catch (err) {
12475
+ log.error(`Test Failure: ${err}`);
12476
+ done(err);
12477
+ }
12478
+ });
12479
+ } catch (error) {
12480
+ log.error(`Adapter Exception: ${error}`);
12481
+ done(error);
12482
+ }
12483
+ }).timeout(attemptTimeout);
12484
+ });
12485
+
12486
+ describe('#getFieldsPaginated - errors', () => {
12487
+ it('should work if integrated or standalone with mockdata', (done) => {
12488
+ try {
12489
+ a.getFieldsPaginated(null, null, null, null, null, null, null, (data, error) => {
12490
+ try {
12491
+ if (stub) {
12492
+ runCommonAsserts(data, error);
12493
+ assert.equal(50, data.response.maxResults);
12494
+ assert.equal(0, data.response.startAt);
12495
+ assert.equal(2, data.response.total);
12496
+ assert.equal(false, data.response.isLast);
12497
+ assert.equal(true, Array.isArray(data.response.values));
12498
+ } else {
12499
+ runCommonAsserts(data, error);
12500
+ }
12501
+ saveMockData('IssueFields', 'getFieldsPaginated', 'default', data);
12502
+ done();
12503
+ } catch (err) {
12504
+ log.error(`Test Failure: ${err}`);
12505
+ done(err);
12506
+ }
12507
+ });
12508
+ } catch (error) {
12509
+ log.error(`Adapter Exception: ${error}`);
12510
+ done(error);
12511
+ }
12512
+ }).timeout(attemptTimeout);
12513
+ });
12514
+
12515
+ const issueFieldsUpdateCustomFieldBodyParam = {
12516
+ name: 'string',
12517
+ description: 'string',
12518
+ searcherKey: 'com.atlassian.jira.plugin.system.customfieldtypes:multiselectsearcher'
12519
+ };
12520
+ describe('#updateCustomField - errors', () => {
12521
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12522
+ try {
12523
+ a.updateCustomField('fakedata', issueFieldsUpdateCustomFieldBodyParam, (data, error) => {
12524
+ try {
12525
+ if (stub) {
12526
+ const displayE = 'Error 400 received on request';
12527
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12528
+ } else {
12529
+ runCommonAsserts(data, error);
12530
+ }
12531
+ saveMockData('IssueFields', 'updateCustomField', 'default', data);
12532
+ done();
12533
+ } catch (err) {
12534
+ log.error(`Test Failure: ${err}`);
12535
+ done(err);
12536
+ }
12537
+ });
12538
+ } catch (error) {
12539
+ log.error(`Adapter Exception: ${error}`);
12540
+ done(error);
12541
+ }
12542
+ }).timeout(attemptTimeout);
12543
+ });
12544
+
12545
+ describe('#getContextsForFieldDeprecated - errors', () => {
12546
+ it('should work if integrated or standalone with mockdata', (done) => {
12547
+ try {
12548
+ a.getContextsForFieldDeprecated('fakedata', null, null, (data, error) => {
12549
+ try {
12550
+ if (stub) {
12551
+ runCommonAsserts(data, error);
12552
+ assert.equal(1, data.response.maxResults);
12553
+ assert.equal(0, data.response.startAt);
12554
+ assert.equal(5, data.response.total);
12555
+ assert.equal(false, data.response.isLast);
12556
+ assert.equal(true, Array.isArray(data.response.values));
12557
+ } else {
12558
+ runCommonAsserts(data, error);
12559
+ }
12560
+ saveMockData('IssueFields', 'getContextsForFieldDeprecated', 'default', data);
12561
+ done();
12562
+ } catch (err) {
12563
+ log.error(`Test Failure: ${err}`);
12564
+ done(err);
12565
+ }
12566
+ });
12567
+ } catch (error) {
12568
+ log.error(`Adapter Exception: ${error}`);
12569
+ done(error);
12570
+ }
12571
+ }).timeout(attemptTimeout);
12572
+ });
12573
+
12574
+ describe('#deleteCustomField - errors', () => {
12575
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12576
+ try {
12577
+ a.deleteCustomField('fakedata', (data, error) => {
12578
+ try {
12579
+ if (stub) {
12580
+ const displayE = 'Error 400 received on request';
12581
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12582
+ } else {
12583
+ runCommonAsserts(data, error);
12584
+ }
12585
+ saveMockData('IssueFields', 'deleteCustomField', 'default', data);
12586
+ done();
12587
+ } catch (err) {
12588
+ log.error(`Test Failure: ${err}`);
12589
+ done(err);
12590
+ }
12591
+ });
12592
+ } catch (error) {
12593
+ log.error(`Adapter Exception: ${error}`);
12594
+ done(error);
12595
+ }
12596
+ }).timeout(attemptTimeout);
12597
+ });
12598
+
12599
+ describe('#restoreCustomField - errors', () => {
12600
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12601
+ try {
12602
+ a.restoreCustomField('fakedata', (data, error) => {
12603
+ try {
12604
+ if (stub) {
12605
+ const displayE = 'Error 400 received on request';
12606
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12607
+ } else {
12608
+ runCommonAsserts(data, error);
12609
+ }
12610
+ saveMockData('IssueFields', 'restoreCustomField', 'default', data);
12611
+ done();
12612
+ } catch (err) {
12613
+ log.error(`Test Failure: ${err}`);
12614
+ done(err);
12615
+ }
12616
+ });
12617
+ } catch (error) {
12618
+ log.error(`Adapter Exception: ${error}`);
12619
+ done(error);
12620
+ }
12621
+ }).timeout(attemptTimeout);
12622
+ });
12623
+
12624
+ describe('#trashCustomField - errors', () => {
12625
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12626
+ try {
12627
+ a.trashCustomField('fakedata', (data, error) => {
12628
+ try {
12629
+ if (stub) {
12630
+ const displayE = 'Error 400 received on request';
12631
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12632
+ } else {
12633
+ runCommonAsserts(data, error);
12634
+ }
12635
+ saveMockData('IssueFields', 'trashCustomField', 'default', data);
12636
+ done();
12637
+ } catch (err) {
12638
+ log.error(`Test Failure: ${err}`);
12639
+ done(err);
12640
+ }
12641
+ });
12642
+ } catch (error) {
12643
+ log.error(`Adapter Exception: ${error}`);
12644
+ done(error);
12645
+ }
12646
+ }).timeout(attemptTimeout);
12647
+ });
12648
+
12649
+ describe('#getContextsForField - errors', () => {
12650
+ it('should work if integrated or standalone with mockdata', (done) => {
12651
+ try {
12652
+ a.getContextsForField('fakedata', null, null, null, null, null, (data, error) => {
12653
+ try {
12654
+ if (stub) {
12655
+ runCommonAsserts(data, error);
12656
+ assert.equal(100, data.response.maxResults);
12657
+ assert.equal(0, data.response.startAt);
12658
+ assert.equal(2, data.response.total);
12659
+ assert.equal(true, data.response.isLast);
12660
+ assert.equal(true, Array.isArray(data.response.values));
12661
+ } else {
12662
+ runCommonAsserts(data, error);
12663
+ }
12664
+ saveMockData('IssueCustomFieldContexts', 'getContextsForField', 'default', data);
12665
+ done();
12666
+ } catch (err) {
12667
+ log.error(`Test Failure: ${err}`);
12668
+ done(err);
12669
+ }
12670
+ });
12671
+ } catch (error) {
12672
+ log.error(`Adapter Exception: ${error}`);
12673
+ done(error);
12674
+ }
12675
+ }).timeout(attemptTimeout);
12676
+ });
12677
+
12678
+ const issueCustomFieldContextsCreateCustomFieldContextBodyParam = {
12679
+ name: 'string'
12680
+ };
12681
+ describe('#createCustomFieldContext - errors', () => {
12682
+ it('should work if integrated or standalone with mockdata', (done) => {
12683
+ try {
12684
+ a.createCustomFieldContext('fakedata', issueCustomFieldContextsCreateCustomFieldContextBodyParam, (data, error) => {
12685
+ try {
12686
+ if (stub) {
12687
+ runCommonAsserts(data, error);
12688
+ assert.equal('10025', data.response.id);
12689
+ assert.equal('Bug fields context', data.response.name);
12690
+ assert.equal('A context used to define the custom field options for bugs.', data.response.description);
12691
+ assert.equal(true, Array.isArray(data.response.projectIds));
12692
+ assert.equal(true, Array.isArray(data.response.issueTypeIds));
12693
+ } else {
12694
+ runCommonAsserts(data, error);
12695
+ }
12696
+ saveMockData('IssueCustomFieldContexts', 'createCustomFieldContext', 'default', data);
12697
+ done();
12698
+ } catch (err) {
12699
+ log.error(`Test Failure: ${err}`);
12700
+ done(err);
12701
+ }
12702
+ });
12703
+ } catch (error) {
12704
+ log.error(`Adapter Exception: ${error}`);
12705
+ done(error);
12706
+ }
12707
+ }).timeout(attemptTimeout);
12708
+ });
12709
+
12710
+ describe('#getDefaultValues - errors', () => {
12711
+ it('should work if integrated or standalone with mockdata', (done) => {
12712
+ try {
12713
+ a.getDefaultValues('fakedata', null, null, null, (data, error) => {
12714
+ try {
12715
+ if (stub) {
12716
+ runCommonAsserts(data, error);
12717
+ assert.equal(50, data.response.maxResults);
12718
+ assert.equal(0, data.response.startAt);
12719
+ assert.equal(3, data.response.total);
12720
+ assert.equal(true, data.response.isLast);
12721
+ assert.equal(true, Array.isArray(data.response.values));
12722
+ } else {
12723
+ runCommonAsserts(data, error);
12724
+ }
12725
+ saveMockData('IssueCustomFieldContexts', 'getDefaultValues', 'default', data);
12726
+ done();
12727
+ } catch (err) {
12728
+ log.error(`Test Failure: ${err}`);
12729
+ done(err);
12730
+ }
12731
+ });
12732
+ } catch (error) {
12733
+ log.error(`Adapter Exception: ${error}`);
12734
+ done(error);
12735
+ }
12736
+ }).timeout(attemptTimeout);
12737
+ });
12738
+
12739
+ const issueCustomFieldContextsSetDefaultValuesBodyParam = {
12740
+ defaultValues: [
12741
+ {}
12742
+ ]
12743
+ };
12744
+ describe('#setDefaultValues - errors', () => {
12745
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12746
+ try {
12747
+ a.setDefaultValues('fakedata', issueCustomFieldContextsSetDefaultValuesBodyParam, (data, error) => {
12748
+ try {
12749
+ if (stub) {
12750
+ const displayE = 'Error 400 received on request';
12751
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12752
+ } else {
12753
+ runCommonAsserts(data, error);
12754
+ }
12755
+ saveMockData('IssueCustomFieldContexts', 'setDefaultValues', 'default', data);
12756
+ done();
12757
+ } catch (err) {
12758
+ log.error(`Test Failure: ${err}`);
12759
+ done(err);
12760
+ }
12761
+ });
12762
+ } catch (error) {
12763
+ log.error(`Adapter Exception: ${error}`);
12764
+ done(error);
12765
+ }
12766
+ }).timeout(attemptTimeout);
12767
+ });
12768
+
12769
+ describe('#getIssueTypeMappingsForContexts - errors', () => {
12770
+ it('should work if integrated or standalone with mockdata', (done) => {
12771
+ try {
12772
+ a.getIssueTypeMappingsForContexts('fakedata', null, null, null, (data, error) => {
12773
+ try {
12774
+ if (stub) {
12775
+ runCommonAsserts(data, error);
12776
+ assert.equal(100, data.response.maxResults);
12777
+ assert.equal(0, data.response.startAt);
12778
+ assert.equal(3, data.response.total);
12779
+ assert.equal(true, data.response.isLast);
12780
+ assert.equal(true, Array.isArray(data.response.values));
12781
+ } else {
12782
+ runCommonAsserts(data, error);
12783
+ }
12784
+ saveMockData('IssueCustomFieldContexts', 'getIssueTypeMappingsForContexts', 'default', data);
12785
+ done();
12786
+ } catch (err) {
12787
+ log.error(`Test Failure: ${err}`);
12788
+ done(err);
12789
+ }
12790
+ });
12791
+ } catch (error) {
12792
+ log.error(`Adapter Exception: ${error}`);
12793
+ done(error);
12794
+ }
12795
+ }).timeout(attemptTimeout);
12796
+ });
12797
+
12798
+ const issueCustomFieldContextsGetCustomFieldContextsForProjectsAndIssueTypesBodyParam = {
12799
+ mappings: [
12800
+ {}
12801
+ ]
12802
+ };
12803
+ describe('#getCustomFieldContextsForProjectsAndIssueTypes - errors', () => {
12804
+ it('should work if integrated or standalone with mockdata', (done) => {
12805
+ try {
12806
+ a.getCustomFieldContextsForProjectsAndIssueTypes('fakedata', null, null, issueCustomFieldContextsGetCustomFieldContextsForProjectsAndIssueTypesBodyParam, (data, error) => {
12807
+ try {
12808
+ if (stub) {
12809
+ runCommonAsserts(data, error);
12810
+ assert.equal(50, data.response.maxResults);
12811
+ assert.equal(0, data.response.startAt);
12812
+ assert.equal(3, data.response.total);
12813
+ assert.equal(true, data.response.isLast);
12814
+ assert.equal(true, Array.isArray(data.response.values));
12815
+ } else {
12816
+ runCommonAsserts(data, error);
12817
+ }
12818
+ saveMockData('IssueCustomFieldContexts', 'getCustomFieldContextsForProjectsAndIssueTypes', 'default', data);
12819
+ done();
12820
+ } catch (err) {
12821
+ log.error(`Test Failure: ${err}`);
12822
+ done(err);
12823
+ }
12824
+ });
12825
+ } catch (error) {
12826
+ log.error(`Adapter Exception: ${error}`);
12827
+ done(error);
12828
+ }
12829
+ }).timeout(attemptTimeout);
12830
+ });
12831
+
12832
+ describe('#getProjectContextMapping - errors', () => {
12833
+ it('should work if integrated or standalone with mockdata', (done) => {
12834
+ try {
12835
+ a.getProjectContextMapping('fakedata', null, null, null, (data, error) => {
12836
+ try {
12837
+ if (stub) {
12838
+ runCommonAsserts(data, error);
12839
+ assert.equal(100, data.response.maxResults);
12840
+ assert.equal(0, data.response.startAt);
12841
+ assert.equal(2, data.response.total);
12842
+ assert.equal(true, data.response.isLast);
12843
+ assert.equal(true, Array.isArray(data.response.values));
12844
+ } else {
12845
+ runCommonAsserts(data, error);
12846
+ }
12847
+ saveMockData('IssueCustomFieldContexts', 'getProjectContextMapping', 'default', data);
12848
+ done();
12849
+ } catch (err) {
12850
+ log.error(`Test Failure: ${err}`);
12851
+ done(err);
12852
+ }
12853
+ });
12854
+ } catch (error) {
12855
+ log.error(`Adapter Exception: ${error}`);
12856
+ done(error);
12857
+ }
12858
+ }).timeout(attemptTimeout);
12859
+ });
12860
+
12861
+ const issueCustomFieldContextsUpdateCustomFieldContextBodyParam = {
12862
+ name: 'string',
12863
+ description: 'string'
12864
+ };
12865
+ describe('#updateCustomFieldContext - errors', () => {
12866
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12867
+ try {
12868
+ a.updateCustomFieldContext('fakedata', 555, issueCustomFieldContextsUpdateCustomFieldContextBodyParam, (data, error) => {
12869
+ try {
12870
+ if (stub) {
12871
+ const displayE = 'Error 400 received on request';
12872
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12873
+ } else {
12874
+ runCommonAsserts(data, error);
12875
+ }
12876
+ saveMockData('IssueCustomFieldContexts', 'updateCustomFieldContext', 'default', data);
12877
+ done();
12878
+ } catch (err) {
12879
+ log.error(`Test Failure: ${err}`);
12880
+ done(err);
12881
+ }
12882
+ });
12883
+ } catch (error) {
12884
+ log.error(`Adapter Exception: ${error}`);
12885
+ done(error);
12886
+ }
12887
+ }).timeout(attemptTimeout);
12888
+ });
12889
+
12890
+ describe('#deleteCustomFieldContext - errors', () => {
12891
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12892
+ try {
12893
+ a.deleteCustomFieldContext('fakedata', 555, (data, error) => {
12894
+ try {
12895
+ if (stub) {
12896
+ const displayE = 'Error 400 received on request';
12897
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12898
+ } else {
12899
+ runCommonAsserts(data, error);
12900
+ }
12901
+ saveMockData('IssueCustomFieldContexts', 'deleteCustomFieldContext', 'default', data);
12902
+ done();
12903
+ } catch (err) {
12904
+ log.error(`Test Failure: ${err}`);
12905
+ done(err);
12906
+ }
12907
+ });
12908
+ } catch (error) {
12909
+ log.error(`Adapter Exception: ${error}`);
12910
+ done(error);
12911
+ }
12912
+ }).timeout(attemptTimeout);
12913
+ });
12914
+
12915
+ const issueCustomFieldContextsAddIssueTypesToContextBodyParam = {
12916
+ issueTypeIds: [
12917
+ 'string'
12918
+ ]
12919
+ };
12920
+ describe('#addIssueTypesToContext - errors', () => {
12921
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12922
+ try {
12923
+ a.addIssueTypesToContext('fakedata', 555, issueCustomFieldContextsAddIssueTypesToContextBodyParam, (data, error) => {
12924
+ try {
12925
+ if (stub) {
12926
+ const displayE = 'Error 400 received on request';
12927
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12928
+ } else {
12929
+ runCommonAsserts(data, error);
12930
+ }
12931
+ saveMockData('IssueCustomFieldContexts', 'addIssueTypesToContext', 'default', data);
12932
+ done();
12933
+ } catch (err) {
12934
+ log.error(`Test Failure: ${err}`);
12935
+ done(err);
12936
+ }
12937
+ });
12938
+ } catch (error) {
12939
+ log.error(`Adapter Exception: ${error}`);
12940
+ done(error);
12941
+ }
12942
+ }).timeout(attemptTimeout);
12943
+ });
12944
+
12945
+ const issueCustomFieldContextsRemoveIssueTypesFromContextBodyParam = {
12946
+ issueTypeIds: [
12947
+ 'string'
12948
+ ]
12949
+ };
12950
+ describe('#removeIssueTypesFromContext - errors', () => {
12951
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12952
+ try {
12953
+ a.removeIssueTypesFromContext('fakedata', 555, issueCustomFieldContextsRemoveIssueTypesFromContextBodyParam, (data, error) => {
12954
+ try {
12955
+ if (stub) {
12956
+ const displayE = 'Error 400 received on request';
12957
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12958
+ } else {
12959
+ runCommonAsserts(data, error);
12960
+ }
12961
+ saveMockData('IssueCustomFieldContexts', 'removeIssueTypesFromContext', 'default', data);
12962
+ done();
12963
+ } catch (err) {
12964
+ log.error(`Test Failure: ${err}`);
12965
+ done(err);
12966
+ }
12967
+ });
12968
+ } catch (error) {
12969
+ log.error(`Adapter Exception: ${error}`);
12970
+ done(error);
12971
+ }
12972
+ }).timeout(attemptTimeout);
12973
+ });
12974
+
12975
+ const issueCustomFieldContextsAssignProjectsToCustomFieldContextBodyParam = {
12976
+ projectIds: [
12977
+ 'string'
12978
+ ]
12979
+ };
12980
+ describe('#assignProjectsToCustomFieldContext - errors', () => {
12981
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
12982
+ try {
12983
+ a.assignProjectsToCustomFieldContext('fakedata', 555, issueCustomFieldContextsAssignProjectsToCustomFieldContextBodyParam, (data, error) => {
12984
+ try {
12985
+ if (stub) {
12986
+ const displayE = 'Error 400 received on request';
12987
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
12988
+ } else {
12989
+ runCommonAsserts(data, error);
12990
+ }
12991
+ saveMockData('IssueCustomFieldContexts', 'assignProjectsToCustomFieldContext', 'default', data);
12992
+ done();
12993
+ } catch (err) {
12994
+ log.error(`Test Failure: ${err}`);
12995
+ done(err);
12996
+ }
12997
+ });
12998
+ } catch (error) {
12999
+ log.error(`Adapter Exception: ${error}`);
13000
+ done(error);
13001
+ }
13002
+ }).timeout(attemptTimeout);
13003
+ });
13004
+
13005
+ const issueCustomFieldContextsRemoveCustomFieldContextFromProjectsBodyParam = {
13006
+ projectIds: [
13007
+ 'string'
13008
+ ]
13009
+ };
13010
+ describe('#removeCustomFieldContextFromProjects - errors', () => {
13011
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13012
+ try {
13013
+ a.removeCustomFieldContextFromProjects('fakedata', 555, issueCustomFieldContextsRemoveCustomFieldContextFromProjectsBodyParam, (data, error) => {
13014
+ try {
13015
+ if (stub) {
13016
+ const displayE = 'Error 400 received on request';
13017
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13018
+ } else {
13019
+ runCommonAsserts(data, error);
13020
+ }
13021
+ saveMockData('IssueCustomFieldContexts', 'removeCustomFieldContextFromProjects', 'default', data);
13022
+ done();
13023
+ } catch (err) {
13024
+ log.error(`Test Failure: ${err}`);
13025
+ done(err);
13026
+ }
13027
+ });
13028
+ } catch (error) {
13029
+ log.error(`Adapter Exception: ${error}`);
13030
+ done(error);
13031
+ }
13032
+ }).timeout(attemptTimeout);
13033
+ });
13034
+
13035
+ describe('#getOptionsForContext - errors', () => {
13036
+ it('should work if integrated or standalone with mockdata', (done) => {
13037
+ try {
13038
+ a.getOptionsForContext('fakedata', 555, null, null, null, null, (data, error) => {
13039
+ try {
13040
+ if (stub) {
13041
+ runCommonAsserts(data, error);
13042
+ assert.equal(100, data.response.maxResults);
13043
+ assert.equal(0, data.response.startAt);
13044
+ assert.equal(4, data.response.total);
13045
+ assert.equal(true, data.response.isLast);
13046
+ assert.equal(true, Array.isArray(data.response.values));
13047
+ } else {
13048
+ runCommonAsserts(data, error);
13049
+ }
13050
+ saveMockData('IssueCustomFieldOptions', 'getOptionsForContext', 'default', data);
13051
+ done();
13052
+ } catch (err) {
13053
+ log.error(`Test Failure: ${err}`);
13054
+ done(err);
13055
+ }
13056
+ });
13057
+ } catch (error) {
13058
+ log.error(`Adapter Exception: ${error}`);
13059
+ done(error);
13060
+ }
13061
+ }).timeout(attemptTimeout);
13062
+ });
13063
+
13064
+ const issueCustomFieldOptionsUpdateCustomFieldOptionBodyParam = {
13065
+ options: [
13066
+ {
13067
+ id: 'string',
13068
+ value: 'string',
13069
+ disabled: false
13070
+ }
13071
+ ]
13072
+ };
13073
+ describe('#updateCustomFieldOption - errors', () => {
13074
+ it('should work if integrated or standalone with mockdata', (done) => {
13075
+ try {
13076
+ a.updateCustomFieldOption('fakedata', 555, issueCustomFieldOptionsUpdateCustomFieldOptionBodyParam, (data, error) => {
13077
+ try {
13078
+ if (stub) {
13079
+ runCommonAsserts(data, error);
13080
+ assert.equal('success', data.response);
13081
+ } else {
13082
+ runCommonAsserts(data, error);
13083
+ }
13084
+ saveMockData('IssueCustomFieldOptions', 'updateCustomFieldOption', 'default', data);
13085
+ done();
13086
+ } catch (err) {
13087
+ log.error(`Test Failure: ${err}`);
13088
+ done(err);
13089
+ }
13090
+ });
13091
+ } catch (error) {
13092
+ log.error(`Adapter Exception: ${error}`);
13093
+ done(error);
13094
+ }
13095
+ }).timeout(attemptTimeout);
13096
+ });
13097
+
13098
+ const issueCustomFieldOptionsCreateCustomFieldOptionBodyParam = {
13099
+ options: [
13100
+ {
13101
+ value: 'string',
13102
+ optionId: 'string',
13103
+ disabled: false
13104
+ }
13105
+ ]
13106
+ };
13107
+ describe('#createCustomFieldOption - errors', () => {
13108
+ it('should work if integrated or standalone with mockdata', (done) => {
13109
+ try {
13110
+ a.createCustomFieldOption('fakedata', 555, issueCustomFieldOptionsCreateCustomFieldOptionBodyParam, (data, error) => {
13111
+ try {
13112
+ if (stub) {
13113
+ runCommonAsserts(data, error);
13114
+ assert.equal(true, Array.isArray(data.response.options));
13115
+ } else {
13116
+ runCommonAsserts(data, error);
13117
+ }
13118
+ saveMockData('IssueCustomFieldOptions', 'createCustomFieldOption', 'default', data);
13119
+ done();
13120
+ } catch (err) {
13121
+ log.error(`Test Failure: ${err}`);
13122
+ done(err);
13123
+ }
13124
+ });
13125
+ } catch (error) {
13126
+ log.error(`Adapter Exception: ${error}`);
13127
+ done(error);
13128
+ }
13129
+ }).timeout(attemptTimeout);
13130
+ });
13131
+
13132
+ const issueCustomFieldOptionsReorderCustomFieldOptionsBodyParam = {
13133
+ customFieldOptionIds: [
13134
+ 'string'
13135
+ ]
13136
+ };
13137
+ describe('#reorderCustomFieldOptions - errors', () => {
13138
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13139
+ try {
13140
+ a.reorderCustomFieldOptions('fakedata', 555, issueCustomFieldOptionsReorderCustomFieldOptionsBodyParam, (data, error) => {
13141
+ try {
13142
+ if (stub) {
13143
+ const displayE = 'Error 400 received on request';
13144
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13145
+ } else {
13146
+ runCommonAsserts(data, error);
13147
+ }
13148
+ saveMockData('IssueCustomFieldOptions', 'reorderCustomFieldOptions', 'default', data);
13149
+ done();
13150
+ } catch (err) {
13151
+ log.error(`Test Failure: ${err}`);
13152
+ done(err);
13153
+ }
13154
+ });
13155
+ } catch (error) {
13156
+ log.error(`Adapter Exception: ${error}`);
13157
+ done(error);
13158
+ }
13159
+ }).timeout(attemptTimeout);
13160
+ });
13161
+
13162
+ describe('#deleteCustomFieldOption - errors', () => {
13163
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13164
+ try {
13165
+ a.deleteCustomFieldOption('fakedata', 555, 555, (data, error) => {
13166
+ try {
13167
+ if (stub) {
13168
+ const displayE = 'Error 400 received on request';
13169
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13170
+ } else {
13171
+ runCommonAsserts(data, error);
13172
+ }
13173
+ saveMockData('IssueCustomFieldOptions', 'deleteCustomFieldOption', 'default', data);
13174
+ done();
13175
+ } catch (err) {
13176
+ log.error(`Test Failure: ${err}`);
13177
+ done(err);
13178
+ }
13179
+ });
13180
+ } catch (error) {
13181
+ log.error(`Adapter Exception: ${error}`);
13182
+ done(error);
13183
+ }
13184
+ }).timeout(attemptTimeout);
13185
+ });
13186
+
13187
+ describe('#getScreensForField - errors', () => {
13188
+ it('should work if integrated or standalone with mockdata', (done) => {
13189
+ try {
13190
+ a.getScreensForField('fakedata', null, null, null, (data, error) => {
13191
+ try {
13192
+ if (stub) {
13193
+ runCommonAsserts(data, error);
13194
+ assert.equal(1, data.response.maxResults);
13195
+ assert.equal(0, data.response.startAt);
13196
+ assert.equal(5, data.response.total);
13197
+ assert.equal(false, data.response.isLast);
13198
+ assert.equal(true, Array.isArray(data.response.values));
13199
+ } else {
13200
+ runCommonAsserts(data, error);
13201
+ }
13202
+ saveMockData('Screens', 'getScreensForField', 'default', data);
13203
+ done();
13204
+ } catch (err) {
13205
+ log.error(`Test Failure: ${err}`);
13206
+ done(err);
13207
+ }
13208
+ });
13209
+ } catch (error) {
13210
+ log.error(`Adapter Exception: ${error}`);
13211
+ done(error);
13212
+ }
13213
+ }).timeout(attemptTimeout);
13214
+ });
13215
+
13216
+ const screensCreateScreenBodyParam = {
13217
+ name: 'string'
13218
+ };
13219
+ describe('#createScreen - errors', () => {
13220
+ it('should work if integrated or standalone with mockdata', (done) => {
13221
+ try {
13222
+ a.createScreen(screensCreateScreenBodyParam, (data, error) => {
13223
+ try {
13224
+ if (stub) {
13225
+ runCommonAsserts(data, error);
13226
+ assert.equal(10005, data.response.id);
13227
+ assert.equal('Resolve Security Issue Screen', data.response.name);
13228
+ assert.equal('Enables changes to resolution and linked issues.', data.response.description);
13229
+ } else {
13230
+ runCommonAsserts(data, error);
13231
+ }
13232
+ saveMockData('Screens', 'createScreen', 'default', data);
13233
+ done();
13234
+ } catch (err) {
13235
+ log.error(`Test Failure: ${err}`);
13236
+ done(err);
13237
+ }
13238
+ });
13239
+ } catch (error) {
13240
+ log.error(`Adapter Exception: ${error}`);
13241
+ done(error);
13242
+ }
13243
+ }).timeout(attemptTimeout);
13244
+ });
13245
+
13246
+ const screensUpdateScreenBodyParam = {
13247
+ name: 'string',
13248
+ description: 'string'
13249
+ };
13250
+ describe('#updateScreen - errors', () => {
13251
+ it('should work if integrated or standalone with mockdata', (done) => {
13252
+ try {
13253
+ a.updateScreen(555, screensUpdateScreenBodyParam, (data, error) => {
13254
+ try {
13255
+ if (stub) {
13256
+ runCommonAsserts(data, error);
13257
+ assert.equal('success', data.response);
13258
+ } else {
13259
+ runCommonAsserts(data, error);
13260
+ }
13261
+ saveMockData('Screens', 'updateScreen', 'default', data);
13262
+ done();
13263
+ } catch (err) {
13264
+ log.error(`Test Failure: ${err}`);
13265
+ done(err);
13266
+ }
13267
+ });
13268
+ } catch (error) {
13269
+ log.error(`Adapter Exception: ${error}`);
13270
+ done(error);
13271
+ }
13272
+ }).timeout(attemptTimeout);
13273
+ });
13274
+
13275
+ describe('#deleteScreen - errors', () => {
13276
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13277
+ try {
13278
+ a.deleteScreen(555, (data, error) => {
13279
+ try {
13280
+ if (stub) {
13281
+ const displayE = 'Error 400 received on request';
13282
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13283
+ } else {
13284
+ runCommonAsserts(data, error);
13285
+ }
13286
+ saveMockData('Screens', 'deleteScreen', 'default', data);
13287
+ done();
13288
+ } catch (err) {
13289
+ log.error(`Test Failure: ${err}`);
13290
+ done(err);
13291
+ }
13292
+ });
13293
+ } catch (error) {
13294
+ log.error(`Adapter Exception: ${error}`);
13295
+ done(error);
13296
+ }
13297
+ }).timeout(attemptTimeout);
13298
+ });
13299
+
13300
+ describe('#getAllFieldConfigurations - errors', () => {
13301
+ it('should work if integrated or standalone with mockdata', (done) => {
13302
+ try {
13303
+ a.getAllFieldConfigurations(null, null, null, null, null, (data, error) => {
13304
+ try {
13305
+ if (stub) {
13306
+ runCommonAsserts(data, error);
13307
+ assert.equal(50, data.response.maxResults);
13308
+ assert.equal(0, data.response.startAt);
13309
+ assert.equal(2, data.response.total);
13310
+ assert.equal(true, data.response.isLast);
13311
+ assert.equal(true, Array.isArray(data.response.values));
13312
+ } else {
13313
+ runCommonAsserts(data, error);
13314
+ }
13315
+ saveMockData('IssueFieldConfigurations', 'getAllFieldConfigurations', 'default', data);
13316
+ done();
13317
+ } catch (err) {
13318
+ log.error(`Test Failure: ${err}`);
13319
+ done(err);
13320
+ }
13321
+ });
13322
+ } catch (error) {
13323
+ log.error(`Adapter Exception: ${error}`);
13324
+ done(error);
13325
+ }
13326
+ }).timeout(attemptTimeout);
13327
+ });
13328
+
13329
+ const issueFieldConfigurationsCreateFieldConfigurationBodyParam = {
13330
+ name: 'string'
13331
+ };
13332
+ describe('#createFieldConfiguration - errors', () => {
13333
+ it('should work if integrated or standalone with mockdata', (done) => {
13334
+ try {
13335
+ a.createFieldConfiguration(issueFieldConfigurationsCreateFieldConfigurationBodyParam, (data, error) => {
13336
+ try {
13337
+ if (stub) {
13338
+ runCommonAsserts(data, error);
13339
+ assert.equal(10001, data.response.id);
13340
+ assert.equal('My Field Configuration', data.response.name);
13341
+ assert.equal('My field configuration description', data.response.description);
13342
+ } else {
13343
+ runCommonAsserts(data, error);
13344
+ }
13345
+ saveMockData('IssueFieldConfigurations', 'createFieldConfiguration', 'default', data);
13346
+ done();
13347
+ } catch (err) {
13348
+ log.error(`Test Failure: ${err}`);
13349
+ done(err);
13350
+ }
13351
+ });
13352
+ } catch (error) {
13353
+ log.error(`Adapter Exception: ${error}`);
13354
+ done(error);
13355
+ }
13356
+ }).timeout(attemptTimeout);
13357
+ });
13358
+
13359
+ const issueFieldConfigurationsUpdateFieldConfigurationBodyParam = {
13360
+ name: 'string'
13361
+ };
13362
+ describe('#updateFieldConfiguration - errors', () => {
13363
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13364
+ try {
13365
+ a.updateFieldConfiguration(555, issueFieldConfigurationsUpdateFieldConfigurationBodyParam, (data, error) => {
13366
+ try {
13367
+ if (stub) {
13368
+ const displayE = 'Error 400 received on request';
13369
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13370
+ } else {
13371
+ runCommonAsserts(data, error);
13372
+ }
13373
+ saveMockData('IssueFieldConfigurations', 'updateFieldConfiguration', 'default', data);
13374
+ done();
13375
+ } catch (err) {
13376
+ log.error(`Test Failure: ${err}`);
13377
+ done(err);
13378
+ }
13379
+ });
13380
+ } catch (error) {
13381
+ log.error(`Adapter Exception: ${error}`);
13382
+ done(error);
13383
+ }
13384
+ }).timeout(attemptTimeout);
13385
+ });
13386
+
13387
+ describe('#deleteFieldConfiguration - errors', () => {
13388
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13389
+ try {
13390
+ a.deleteFieldConfiguration(555, (data, error) => {
13391
+ try {
13392
+ if (stub) {
13393
+ const displayE = 'Error 400 received on request';
13394
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13395
+ } else {
13396
+ runCommonAsserts(data, error);
13397
+ }
13398
+ saveMockData('IssueFieldConfigurations', 'deleteFieldConfiguration', 'default', data);
13399
+ done();
13400
+ } catch (err) {
13401
+ log.error(`Test Failure: ${err}`);
13402
+ done(err);
13403
+ }
13404
+ });
13405
+ } catch (error) {
13406
+ log.error(`Adapter Exception: ${error}`);
13407
+ done(error);
13408
+ }
13409
+ }).timeout(attemptTimeout);
13410
+ });
13411
+
13412
+ describe('#getFieldConfigurationItems - errors', () => {
13413
+ it('should work if integrated or standalone with mockdata', (done) => {
13414
+ try {
13415
+ a.getFieldConfigurationItems(555, null, null, (data, error) => {
13416
+ try {
13417
+ if (stub) {
13418
+ runCommonAsserts(data, error);
13419
+ assert.equal(50, data.response.maxResults);
13420
+ assert.equal(0, data.response.startAt);
13421
+ assert.equal(2, data.response.total);
13422
+ assert.equal(true, data.response.isLast);
13423
+ assert.equal(true, Array.isArray(data.response.values));
13424
+ } else {
13425
+ runCommonAsserts(data, error);
13426
+ }
13427
+ saveMockData('IssueFieldConfigurations', 'getFieldConfigurationItems', 'default', data);
13428
+ done();
13429
+ } catch (err) {
13430
+ log.error(`Test Failure: ${err}`);
13431
+ done(err);
13432
+ }
13433
+ });
13434
+ } catch (error) {
13435
+ log.error(`Adapter Exception: ${error}`);
13436
+ done(error);
13437
+ }
13438
+ }).timeout(attemptTimeout);
13439
+ });
13440
+
13441
+ const issueFieldConfigurationsUpdateFieldConfigurationItemsBodyParam = {
13442
+ fieldConfigurationItems: [
13443
+ {}
13444
+ ]
13445
+ };
13446
+ describe('#updateFieldConfigurationItems - errors', () => {
13447
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13448
+ try {
13449
+ a.updateFieldConfigurationItems(555, issueFieldConfigurationsUpdateFieldConfigurationItemsBodyParam, (data, error) => {
13450
+ try {
13451
+ if (stub) {
13452
+ const displayE = 'Error 400 received on request';
13453
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13454
+ } else {
13455
+ runCommonAsserts(data, error);
13456
+ }
13457
+ saveMockData('IssueFieldConfigurations', 'updateFieldConfigurationItems', 'default', data);
13458
+ done();
13459
+ } catch (err) {
13460
+ log.error(`Test Failure: ${err}`);
13461
+ done(err);
13462
+ }
13463
+ });
13464
+ } catch (error) {
13465
+ log.error(`Adapter Exception: ${error}`);
13466
+ done(error);
13467
+ }
13468
+ }).timeout(attemptTimeout);
13469
+ });
13470
+
13471
+ describe('#getAllFieldConfigurationSchemes - errors', () => {
13472
+ it('should work if integrated or standalone with mockdata', (done) => {
13473
+ try {
13474
+ a.getAllFieldConfigurationSchemes(null, null, null, (data, error) => {
13475
+ try {
13476
+ if (stub) {
13477
+ runCommonAsserts(data, error);
13478
+ assert.equal(10, data.response.maxResults);
13479
+ assert.equal(0, data.response.startAt);
13480
+ assert.equal(3, data.response.total);
13481
+ assert.equal(true, data.response.isLast);
13482
+ assert.equal(true, Array.isArray(data.response.values));
13483
+ } else {
13484
+ runCommonAsserts(data, error);
13485
+ }
13486
+ saveMockData('IssueFieldConfigurations', 'getAllFieldConfigurationSchemes', 'default', data);
13487
+ done();
13488
+ } catch (err) {
13489
+ log.error(`Test Failure: ${err}`);
13490
+ done(err);
13491
+ }
13492
+ });
13493
+ } catch (error) {
13494
+ log.error(`Adapter Exception: ${error}`);
13495
+ done(error);
13496
+ }
13497
+ }).timeout(attemptTimeout);
13498
+ });
13499
+
13500
+ const issueFieldConfigurationsCreateFieldConfigurationSchemeBodyParam = {
13501
+ name: 'string'
13502
+ };
13503
+ describe('#createFieldConfigurationScheme - errors', () => {
13504
+ it('should work if integrated or standalone with mockdata', (done) => {
13505
+ try {
13506
+ a.createFieldConfigurationScheme(issueFieldConfigurationsCreateFieldConfigurationSchemeBodyParam, (data, error) => {
13507
+ try {
13508
+ if (stub) {
13509
+ runCommonAsserts(data, error);
13510
+ assert.equal('10002', data.response.id);
13511
+ assert.equal('Field Configuration Scheme for software related projects', data.response.name);
13512
+ assert.equal('We can use this one for software projects.', data.response.description);
13513
+ } else {
13514
+ runCommonAsserts(data, error);
13515
+ }
13516
+ saveMockData('IssueFieldConfigurations', 'createFieldConfigurationScheme', 'default', data);
13517
+ done();
13518
+ } catch (err) {
13519
+ log.error(`Test Failure: ${err}`);
13520
+ done(err);
13521
+ }
13522
+ });
13523
+ } catch (error) {
13524
+ log.error(`Adapter Exception: ${error}`);
13525
+ done(error);
13526
+ }
13527
+ }).timeout(attemptTimeout);
13528
+ });
13529
+
13530
+ describe('#getFieldConfigurationSchemeMappings - errors', () => {
13531
+ it('should work if integrated or standalone with mockdata', (done) => {
13532
+ try {
13533
+ a.getFieldConfigurationSchemeMappings(null, null, null, (data, error) => {
13534
+ try {
13535
+ if (stub) {
13536
+ runCommonAsserts(data, error);
13537
+ assert.equal(100, data.response.maxResults);
13538
+ assert.equal(0, data.response.startAt);
13539
+ assert.equal(5, data.response.total);
13540
+ assert.equal(true, data.response.isLast);
13541
+ assert.equal(true, Array.isArray(data.response.values));
13542
+ } else {
13543
+ runCommonAsserts(data, error);
13544
+ }
13545
+ saveMockData('IssueFieldConfigurations', 'getFieldConfigurationSchemeMappings', 'default', data);
13546
+ done();
13547
+ } catch (err) {
13548
+ log.error(`Test Failure: ${err}`);
13549
+ done(err);
13550
+ }
13551
+ });
13552
+ } catch (error) {
13553
+ log.error(`Adapter Exception: ${error}`);
13554
+ done(error);
13555
+ }
13556
+ }).timeout(attemptTimeout);
13557
+ });
13558
+
13559
+ describe('#getFieldConfigurationSchemeProjectMapping - errors', () => {
13560
+ it('should work if integrated or standalone with mockdata', (done) => {
13561
+ try {
13562
+ a.getFieldConfigurationSchemeProjectMapping(null, null, [], (data, error) => {
13563
+ try {
13564
+ if (stub) {
13565
+ runCommonAsserts(data, error);
13566
+ assert.equal(50, data.response.maxResults);
13567
+ assert.equal(0, data.response.startAt);
13568
+ assert.equal(5, data.response.total);
13569
+ assert.equal(true, data.response.isLast);
13570
+ assert.equal(true, Array.isArray(data.response.values));
13571
+ } else {
13572
+ runCommonAsserts(data, error);
13573
+ }
13574
+ saveMockData('IssueFieldConfigurations', 'getFieldConfigurationSchemeProjectMapping', 'default', data);
13575
+ done();
13576
+ } catch (err) {
13577
+ log.error(`Test Failure: ${err}`);
13578
+ done(err);
13579
+ }
13580
+ });
13581
+ } catch (error) {
13582
+ log.error(`Adapter Exception: ${error}`);
13583
+ done(error);
13584
+ }
13585
+ }).timeout(attemptTimeout);
13586
+ });
13587
+
13588
+ const issueFieldConfigurationsAssignFieldConfigurationSchemeToProjectBodyParam = {
13589
+ projectId: 'string'
13590
+ };
13591
+ describe('#assignFieldConfigurationSchemeToProject - errors', () => {
13592
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13593
+ try {
13594
+ a.assignFieldConfigurationSchemeToProject(issueFieldConfigurationsAssignFieldConfigurationSchemeToProjectBodyParam, (data, error) => {
13595
+ try {
13596
+ if (stub) {
13597
+ const displayE = 'Error 400 received on request';
13598
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13599
+ } else {
13600
+ runCommonAsserts(data, error);
13601
+ }
13602
+ saveMockData('IssueFieldConfigurations', 'assignFieldConfigurationSchemeToProject', 'default', data);
13603
+ done();
13604
+ } catch (err) {
13605
+ log.error(`Test Failure: ${err}`);
13606
+ done(err);
13607
+ }
13608
+ });
13609
+ } catch (error) {
13610
+ log.error(`Adapter Exception: ${error}`);
13611
+ done(error);
13612
+ }
13613
+ }).timeout(attemptTimeout);
13614
+ });
13615
+
13616
+ const issueFieldConfigurationsUpdateFieldConfigurationSchemeBodyParam = {
13617
+ name: 'string'
13618
+ };
13619
+ describe('#updateFieldConfigurationScheme - errors', () => {
13620
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13621
+ try {
13622
+ a.updateFieldConfigurationScheme(555, issueFieldConfigurationsUpdateFieldConfigurationSchemeBodyParam, (data, error) => {
13623
+ try {
13624
+ if (stub) {
13625
+ const displayE = 'Error 400 received on request';
13626
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13627
+ } else {
13628
+ runCommonAsserts(data, error);
13629
+ }
13630
+ saveMockData('IssueFieldConfigurations', 'updateFieldConfigurationScheme', 'default', data);
13631
+ done();
13632
+ } catch (err) {
13633
+ log.error(`Test Failure: ${err}`);
13634
+ done(err);
13635
+ }
13636
+ });
13637
+ } catch (error) {
13638
+ log.error(`Adapter Exception: ${error}`);
13639
+ done(error);
13640
+ }
13641
+ }).timeout(attemptTimeout);
13642
+ });
13643
+
13644
+ describe('#deleteFieldConfigurationScheme - errors', () => {
13645
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13646
+ try {
13647
+ a.deleteFieldConfigurationScheme(555, (data, error) => {
13648
+ try {
13649
+ if (stub) {
13650
+ const displayE = 'Error 400 received on request';
13651
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13652
+ } else {
13653
+ runCommonAsserts(data, error);
13654
+ }
13655
+ saveMockData('IssueFieldConfigurations', 'deleteFieldConfigurationScheme', 'default', data);
13656
+ done();
13657
+ } catch (err) {
13658
+ log.error(`Test Failure: ${err}`);
13659
+ done(err);
13660
+ }
13661
+ });
13662
+ } catch (error) {
13663
+ log.error(`Adapter Exception: ${error}`);
13664
+ done(error);
13665
+ }
13666
+ }).timeout(attemptTimeout);
13667
+ });
13668
+
13669
+ const issueFieldConfigurationsSetFieldConfigurationSchemeMappingBodyParam = {
13670
+ mappings: [
13671
+ {}
13672
+ ]
13673
+ };
13674
+ describe('#setFieldConfigurationSchemeMapping - errors', () => {
13675
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13676
+ try {
13677
+ a.setFieldConfigurationSchemeMapping(555, issueFieldConfigurationsSetFieldConfigurationSchemeMappingBodyParam, (data, error) => {
13678
+ try {
13679
+ if (stub) {
13680
+ const displayE = 'Error 400 received on request';
13681
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13682
+ } else {
13683
+ runCommonAsserts(data, error);
13684
+ }
13685
+ saveMockData('IssueFieldConfigurations', 'setFieldConfigurationSchemeMapping', 'default', data);
13686
+ done();
13687
+ } catch (err) {
13688
+ log.error(`Test Failure: ${err}`);
13689
+ done(err);
13690
+ }
13691
+ });
13692
+ } catch (error) {
13693
+ log.error(`Adapter Exception: ${error}`);
13694
+ done(error);
13695
+ }
13696
+ }).timeout(attemptTimeout);
13697
+ });
13698
+
13699
+ const issueFieldConfigurationsRemoveIssueTypesFromGlobalFieldConfigurationSchemeBodyParam = {
13700
+ issueTypeIds: [
13701
+ 'string'
13702
+ ]
13703
+ };
13704
+ describe('#removeIssueTypesFromGlobalFieldConfigurationScheme - errors', () => {
13705
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13706
+ try {
13707
+ a.removeIssueTypesFromGlobalFieldConfigurationScheme(555, issueFieldConfigurationsRemoveIssueTypesFromGlobalFieldConfigurationSchemeBodyParam, (data, error) => {
13708
+ try {
13709
+ if (stub) {
13710
+ const displayE = 'Error 400 received on request';
13711
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13712
+ } else {
13713
+ runCommonAsserts(data, error);
13714
+ }
13715
+ saveMockData('IssueFieldConfigurations', 'removeIssueTypesFromGlobalFieldConfigurationScheme', 'default', data);
13716
+ done();
13717
+ } catch (err) {
13718
+ log.error(`Test Failure: ${err}`);
13719
+ done(err);
13720
+ }
13721
+ });
13722
+ } catch (error) {
13723
+ log.error(`Adapter Exception: ${error}`);
13724
+ done(error);
13725
+ }
13726
+ }).timeout(attemptTimeout);
13727
+ });
13728
+
13729
+ describe('#bulkGetGroups - errors', () => {
13730
+ it('should work if integrated or standalone with mockdata', (done) => {
13731
+ try {
13732
+ a.bulkGetGroups(null, null, null, null, (data, error) => {
13733
+ try {
13734
+ if (stub) {
13735
+ runCommonAsserts(data, error);
13736
+ assert.equal(10, data.response.maxResults);
13737
+ assert.equal(0, data.response.startAt);
13738
+ assert.equal(2, data.response.total);
13739
+ assert.equal(true, data.response.isLast);
13740
+ assert.equal(true, Array.isArray(data.response.values));
13741
+ } else {
13742
+ runCommonAsserts(data, error);
13743
+ }
13744
+ saveMockData('Groups', 'bulkGetGroups', 'default', data);
13745
+ done();
13746
+ } catch (err) {
13747
+ log.error(`Test Failure: ${err}`);
13748
+ done(err);
13749
+ }
13750
+ });
13751
+ } catch (error) {
13752
+ log.error(`Adapter Exception: ${error}`);
13753
+ done(error);
13754
+ }
13755
+ }).timeout(attemptTimeout);
13756
+ });
13757
+
13758
+ describe('#getLicense - errors', () => {
13759
+ it('should work if integrated or standalone with mockdata', (done) => {
13760
+ try {
13761
+ a.getLicense((data, error) => {
13762
+ try {
13763
+ if (stub) {
13764
+ runCommonAsserts(data, error);
13765
+ assert.equal(true, Array.isArray(data.response.applications));
13766
+ } else {
13767
+ runCommonAsserts(data, error);
13768
+ }
13769
+ saveMockData('InstanceInformation', 'getLicense', 'default', data);
13770
+ done();
13771
+ } catch (err) {
13772
+ log.error(`Test Failure: ${err}`);
13773
+ done(err);
13774
+ }
13775
+ });
13776
+ } catch (error) {
13777
+ log.error(`Adapter Exception: ${error}`);
13778
+ done(error);
13779
+ }
13780
+ }).timeout(attemptTimeout);
13781
+ });
13782
+
13783
+ const issuePropertiesBulkSetIssuesPropertiesListBodyParam = {
13784
+ entitiesIds: [
13785
+ 3
13786
+ ],
13787
+ properties: {}
13788
+ };
13789
+ describe('#bulkSetIssuesPropertiesList - errors', () => {
13790
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13791
+ try {
13792
+ a.bulkSetIssuesPropertiesList(issuePropertiesBulkSetIssuesPropertiesListBodyParam, (data, error) => {
13793
+ try {
13794
+ if (stub) {
13795
+ const displayE = 'Error 400 received on request';
13796
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13797
+ } else {
13798
+ runCommonAsserts(data, error);
13799
+ }
13800
+ saveMockData('IssueProperties', 'bulkSetIssuesPropertiesList', 'default', data);
13801
+ done();
13802
+ } catch (err) {
13803
+ log.error(`Test Failure: ${err}`);
13804
+ done(err);
13805
+ }
13806
+ });
13807
+ } catch (error) {
13808
+ log.error(`Adapter Exception: ${error}`);
13809
+ done(error);
13810
+ }
13811
+ }).timeout(attemptTimeout);
13812
+ });
13813
+
13814
+ const issuePropertiesBulkSetIssuePropertiesByIssueBodyParam = {
13815
+ issues: [
13816
+ {
13817
+ issueID: 4,
13818
+ properties: {}
13819
+ }
13820
+ ]
13821
+ };
13822
+ describe('#bulkSetIssuePropertiesByIssue - errors', () => {
13823
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
13824
+ try {
13825
+ a.bulkSetIssuePropertiesByIssue(issuePropertiesBulkSetIssuePropertiesByIssueBodyParam, (data, error) => {
13826
+ try {
13827
+ if (stub) {
13828
+ const displayE = 'Error 400 received on request';
13829
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
13830
+ } else {
13831
+ runCommonAsserts(data, error);
13832
+ }
13833
+ saveMockData('IssueProperties', 'bulkSetIssuePropertiesByIssue', 'default', data);
13834
+ done();
13835
+ } catch (err) {
13836
+ log.error(`Test Failure: ${err}`);
13837
+ done(err);
13838
+ }
13839
+ });
13840
+ } catch (error) {
13841
+ log.error(`Adapter Exception: ${error}`);
13842
+ done(error);
13843
+ }
13844
+ }).timeout(attemptTimeout);
13845
+ });
13846
+
13847
+ const issueWatchersGetIsWatchingIssueBulkBodyParam = {
13848
+ issueIds: [
13849
+ 'string'
13850
+ ]
13851
+ };
13852
+ describe('#getIsWatchingIssueBulk - errors', () => {
13853
+ it('should work if integrated or standalone with mockdata', (done) => {
13854
+ try {
13855
+ a.getIsWatchingIssueBulk(issueWatchersGetIsWatchingIssueBulkBodyParam, (data, error) => {
13856
+ try {
13857
+ if (stub) {
13858
+ runCommonAsserts(data, error);
13859
+ assert.equal('object', typeof data.response.issuesIsWatching);
13860
+ } else {
13861
+ runCommonAsserts(data, error);
13862
+ }
13863
+ saveMockData('IssueWatchers', 'getIsWatchingIssueBulk', 'default', data);
13864
+ done();
13865
+ } catch (err) {
13866
+ log.error(`Test Failure: ${err}`);
13867
+ done(err);
13868
+ }
13869
+ });
13870
+ } catch (error) {
13871
+ log.error(`Adapter Exception: ${error}`);
13872
+ done(error);
13873
+ }
13874
+ }).timeout(attemptTimeout);
13875
+ });
13876
+
13877
+ describe('#getIssueSecurityLevelMembers - errors', () => {
13878
+ it('should work if integrated or standalone with mockdata', (done) => {
13879
+ try {
13880
+ a.getIssueSecurityLevelMembers(555, null, null, null, null, (data, error) => {
13881
+ try {
13882
+ if (stub) {
13883
+ runCommonAsserts(data, error);
13884
+ assert.equal(100, data.response.maxResults);
13885
+ assert.equal(0, data.response.startAt);
13886
+ assert.equal(3, data.response.total);
13887
+ assert.equal(true, data.response.isLast);
13888
+ assert.equal(true, Array.isArray(data.response.values));
13889
+ } else {
13890
+ runCommonAsserts(data, error);
13891
+ }
13892
+ saveMockData('IssueSecurityLevel', 'getIssueSecurityLevelMembers', 'default', data);
13893
+ done();
13894
+ } catch (err) {
13895
+ log.error(`Test Failure: ${err}`);
13896
+ done(err);
13897
+ }
13898
+ });
13899
+ } catch (error) {
13900
+ log.error(`Adapter Exception: ${error}`);
13901
+ done(error);
13902
+ }
13903
+ }).timeout(attemptTimeout);
13904
+ });
13905
+
13906
+ describe('#getIssueTypesForProject - errors', () => {
13907
+ it('should work if integrated or standalone with mockdata', (done) => {
13908
+ try {
13909
+ a.getIssueTypesForProject(555, null, (data, error) => {
13910
+ try {
13911
+ if (stub) {
13912
+ runCommonAsserts(data, error);
13913
+ assert.equal('object', typeof data.response[0]);
13914
+ assert.equal('object', typeof data.response[1]);
13915
+ } else {
13916
+ runCommonAsserts(data, error);
13917
+ }
13918
+ saveMockData('IssueTypes', 'getIssueTypesForProject', 'default', data);
13919
+ done();
13920
+ } catch (err) {
13921
+ log.error(`Test Failure: ${err}`);
13922
+ done(err);
13923
+ }
13924
+ });
13925
+ } catch (error) {
13926
+ log.error(`Adapter Exception: ${error}`);
13927
+ done(error);
13928
+ }
13929
+ }).timeout(attemptTimeout);
13930
+ });
13931
+
13932
+ describe('#getAllIssueTypeSchemes - errors', () => {
13933
+ it('should work if integrated or standalone with mockdata', (done) => {
13934
+ try {
13935
+ a.getAllIssueTypeSchemes(null, null, null, (data, error) => {
13936
+ try {
13937
+ if (stub) {
13938
+ runCommonAsserts(data, error);
13939
+ assert.equal(100, data.response.maxResults);
13940
+ assert.equal(0, data.response.startAt);
13941
+ assert.equal(3, data.response.total);
13942
+ assert.equal(true, data.response.isLast);
13943
+ assert.equal(true, Array.isArray(data.response.values));
13944
+ } else {
13945
+ runCommonAsserts(data, error);
13946
+ }
13947
+ saveMockData('IssueTypeSchemes', 'getAllIssueTypeSchemes', 'default', data);
13948
+ done();
13949
+ } catch (err) {
13950
+ log.error(`Test Failure: ${err}`);
13951
+ done(err);
13952
+ }
13953
+ });
13954
+ } catch (error) {
13955
+ log.error(`Adapter Exception: ${error}`);
13956
+ done(error);
13957
+ }
13958
+ }).timeout(attemptTimeout);
13959
+ });
13960
+
13961
+ const issueTypeSchemesCreateIssueTypeSchemeBodyParam = {
13962
+ name: 'string',
13963
+ issueTypeIds: [
13964
+ 'string'
13965
+ ]
13966
+ };
13967
+ describe('#createIssueTypeScheme - errors', () => {
13968
+ it('should work if integrated or standalone with mockdata', (done) => {
13969
+ try {
13970
+ a.createIssueTypeScheme(issueTypeSchemesCreateIssueTypeSchemeBodyParam, (data, error) => {
13971
+ try {
13972
+ if (stub) {
13973
+ runCommonAsserts(data, error);
13974
+ assert.equal('10010', data.response.issueTypeSchemeId);
13975
+ } else {
13976
+ runCommonAsserts(data, error);
13977
+ }
13978
+ saveMockData('IssueTypeSchemes', 'createIssueTypeScheme', 'default', data);
13979
+ done();
13980
+ } catch (err) {
13981
+ log.error(`Test Failure: ${err}`);
13982
+ done(err);
13983
+ }
13984
+ });
13985
+ } catch (error) {
13986
+ log.error(`Adapter Exception: ${error}`);
13987
+ done(error);
13988
+ }
13989
+ }).timeout(attemptTimeout);
13990
+ });
13991
+
13992
+ describe('#getIssueTypeSchemesMapping - errors', () => {
13993
+ it('should work if integrated or standalone with mockdata', (done) => {
13994
+ try {
13995
+ a.getIssueTypeSchemesMapping(null, null, null, (data, error) => {
13996
+ try {
13997
+ if (stub) {
13998
+ runCommonAsserts(data, error);
13999
+ assert.equal(100, data.response.maxResults);
14000
+ assert.equal(0, data.response.startAt);
14001
+ assert.equal(4, data.response.total);
14002
+ assert.equal(true, data.response.isLast);
14003
+ assert.equal(true, Array.isArray(data.response.values));
14004
+ } else {
14005
+ runCommonAsserts(data, error);
14006
+ }
14007
+ saveMockData('IssueTypeSchemes', 'getIssueTypeSchemesMapping', 'default', data);
14008
+ done();
14009
+ } catch (err) {
14010
+ log.error(`Test Failure: ${err}`);
14011
+ done(err);
14012
+ }
14013
+ });
14014
+ } catch (error) {
14015
+ log.error(`Adapter Exception: ${error}`);
14016
+ done(error);
14017
+ }
14018
+ }).timeout(attemptTimeout);
14019
+ });
14020
+
14021
+ describe('#getIssueTypeSchemeForProjects - errors', () => {
14022
+ it('should work if integrated or standalone with mockdata', (done) => {
14023
+ try {
14024
+ a.getIssueTypeSchemeForProjects(null, null, [], (data, error) => {
14025
+ try {
14026
+ if (stub) {
14027
+ runCommonAsserts(data, error);
14028
+ assert.equal(100, data.response.maxResults);
14029
+ assert.equal(0, data.response.startAt);
14030
+ assert.equal(3, data.response.total);
14031
+ assert.equal(true, data.response.isLast);
14032
+ assert.equal(true, Array.isArray(data.response.values));
14033
+ } else {
14034
+ runCommonAsserts(data, error);
14035
+ }
14036
+ saveMockData('IssueTypeSchemes', 'getIssueTypeSchemeForProjects', 'default', data);
14037
+ done();
14038
+ } catch (err) {
14039
+ log.error(`Test Failure: ${err}`);
14040
+ done(err);
14041
+ }
14042
+ });
14043
+ } catch (error) {
14044
+ log.error(`Adapter Exception: ${error}`);
14045
+ done(error);
14046
+ }
14047
+ }).timeout(attemptTimeout);
14048
+ });
14049
+
14050
+ const issueTypeSchemesAssignIssueTypeSchemeToProjectBodyParam = {
14051
+ issueTypeSchemeId: 'string',
14052
+ projectId: 'string'
14053
+ };
14054
+ describe('#assignIssueTypeSchemeToProject - errors', () => {
14055
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14056
+ try {
14057
+ a.assignIssueTypeSchemeToProject(issueTypeSchemesAssignIssueTypeSchemeToProjectBodyParam, (data, error) => {
14058
+ try {
14059
+ if (stub) {
14060
+ const displayE = 'Error 400 received on request';
14061
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14062
+ } else {
14063
+ runCommonAsserts(data, error);
14064
+ }
14065
+ saveMockData('IssueTypeSchemes', 'assignIssueTypeSchemeToProject', 'default', data);
14066
+ done();
14067
+ } catch (err) {
14068
+ log.error(`Test Failure: ${err}`);
14069
+ done(err);
14070
+ }
14071
+ });
14072
+ } catch (error) {
14073
+ log.error(`Adapter Exception: ${error}`);
14074
+ done(error);
14075
+ }
14076
+ }).timeout(attemptTimeout);
14077
+ });
14078
+
14079
+ const issueTypeSchemesUpdateIssueTypeSchemeBodyParam = {
14080
+ name: 'string',
14081
+ description: 'string',
14082
+ defaultIssueTypeId: 'string'
14083
+ };
14084
+ describe('#updateIssueTypeScheme - errors', () => {
14085
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14086
+ try {
14087
+ a.updateIssueTypeScheme(555, issueTypeSchemesUpdateIssueTypeSchemeBodyParam, (data, error) => {
14088
+ try {
14089
+ if (stub) {
14090
+ const displayE = 'Error 400 received on request';
14091
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14092
+ } else {
14093
+ runCommonAsserts(data, error);
14094
+ }
14095
+ saveMockData('IssueTypeSchemes', 'updateIssueTypeScheme', 'default', data);
14096
+ done();
14097
+ } catch (err) {
14098
+ log.error(`Test Failure: ${err}`);
14099
+ done(err);
14100
+ }
14101
+ });
14102
+ } catch (error) {
14103
+ log.error(`Adapter Exception: ${error}`);
14104
+ done(error);
14105
+ }
14106
+ }).timeout(attemptTimeout);
14107
+ });
14108
+
14109
+ describe('#deleteIssueTypeScheme - errors', () => {
14110
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14111
+ try {
14112
+ a.deleteIssueTypeScheme(555, (data, error) => {
14113
+ try {
14114
+ if (stub) {
14115
+ const displayE = 'Error 400 received on request';
14116
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14117
+ } else {
14118
+ runCommonAsserts(data, error);
14119
+ }
14120
+ saveMockData('IssueTypeSchemes', 'deleteIssueTypeScheme', 'default', data);
14121
+ done();
14122
+ } catch (err) {
14123
+ log.error(`Test Failure: ${err}`);
14124
+ done(err);
14125
+ }
14126
+ });
14127
+ } catch (error) {
14128
+ log.error(`Adapter Exception: ${error}`);
14129
+ done(error);
14130
+ }
14131
+ }).timeout(attemptTimeout);
14132
+ });
14133
+
14134
+ const issueTypeSchemesAddIssueTypesToIssueTypeSchemeBodyParam = {
14135
+ issueTypeIds: [
14136
+ 'string'
14137
+ ]
14138
+ };
14139
+ describe('#addIssueTypesToIssueTypeScheme - errors', () => {
14140
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14141
+ try {
14142
+ a.addIssueTypesToIssueTypeScheme(555, issueTypeSchemesAddIssueTypesToIssueTypeSchemeBodyParam, (data, error) => {
14143
+ try {
14144
+ if (stub) {
14145
+ const displayE = 'Error 400 received on request';
14146
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14147
+ } else {
14148
+ runCommonAsserts(data, error);
14149
+ }
14150
+ saveMockData('IssueTypeSchemes', 'addIssueTypesToIssueTypeScheme', 'default', data);
14151
+ done();
14152
+ } catch (err) {
14153
+ log.error(`Test Failure: ${err}`);
14154
+ done(err);
14155
+ }
14156
+ });
14157
+ } catch (error) {
14158
+ log.error(`Adapter Exception: ${error}`);
14159
+ done(error);
14160
+ }
14161
+ }).timeout(attemptTimeout);
14162
+ });
14163
+
14164
+ const issueTypeSchemesReorderIssueTypesInIssueTypeSchemeBodyParam = {
14165
+ issueTypeIds: [
14166
+ 'string'
14167
+ ]
14168
+ };
14169
+ describe('#reorderIssueTypesInIssueTypeScheme - errors', () => {
14170
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14171
+ try {
14172
+ a.reorderIssueTypesInIssueTypeScheme(555, issueTypeSchemesReorderIssueTypesInIssueTypeSchemeBodyParam, (data, error) => {
14173
+ try {
14174
+ if (stub) {
14175
+ const displayE = 'Error 400 received on request';
14176
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14177
+ } else {
14178
+ runCommonAsserts(data, error);
14179
+ }
14180
+ saveMockData('IssueTypeSchemes', 'reorderIssueTypesInIssueTypeScheme', 'default', data);
14181
+ done();
14182
+ } catch (err) {
14183
+ log.error(`Test Failure: ${err}`);
14184
+ done(err);
14185
+ }
14186
+ });
14187
+ } catch (error) {
14188
+ log.error(`Adapter Exception: ${error}`);
14189
+ done(error);
14190
+ }
14191
+ }).timeout(attemptTimeout);
14192
+ });
14193
+
14194
+ describe('#removeIssueTypeFromIssueTypeScheme - errors', () => {
14195
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14196
+ try {
14197
+ a.removeIssueTypeFromIssueTypeScheme(555, 555, (data, error) => {
14198
+ try {
14199
+ if (stub) {
14200
+ const displayE = 'Error 400 received on request';
14201
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14202
+ } else {
14203
+ runCommonAsserts(data, error);
14204
+ }
14205
+ saveMockData('IssueTypeSchemes', 'removeIssueTypeFromIssueTypeScheme', 'default', data);
14206
+ done();
14207
+ } catch (err) {
14208
+ log.error(`Test Failure: ${err}`);
14209
+ done(err);
14210
+ }
14211
+ });
14212
+ } catch (error) {
14213
+ log.error(`Adapter Exception: ${error}`);
14214
+ done(error);
14215
+ }
14216
+ }).timeout(attemptTimeout);
14217
+ });
14218
+
14219
+ describe('#getIssueTypeScreenSchemes - errors', () => {
14220
+ it('should work if integrated or standalone with mockdata', (done) => {
14221
+ try {
14222
+ a.getIssueTypeScreenSchemes(null, null, null, (data, error) => {
14223
+ try {
14224
+ if (stub) {
14225
+ runCommonAsserts(data, error);
14226
+ assert.equal(100, data.response.maxResults);
14227
+ assert.equal(0, data.response.startAt);
14228
+ assert.equal(2, data.response.total);
14229
+ assert.equal(true, data.response.isLast);
14230
+ assert.equal(true, Array.isArray(data.response.values));
14231
+ } else {
14232
+ runCommonAsserts(data, error);
14233
+ }
14234
+ saveMockData('IssueTypeScreenSchemes', 'getIssueTypeScreenSchemes', 'default', data);
14235
+ done();
14236
+ } catch (err) {
14237
+ log.error(`Test Failure: ${err}`);
14238
+ done(err);
14239
+ }
14240
+ });
14241
+ } catch (error) {
14242
+ log.error(`Adapter Exception: ${error}`);
14243
+ done(error);
14244
+ }
14245
+ }).timeout(attemptTimeout);
14246
+ });
14247
+
14248
+ const issueTypeScreenSchemesCreateIssueTypeScreenSchemeBodyParam = {
14249
+ name: 'string',
14250
+ issueTypeMappings: [
14251
+ {}
14252
+ ]
14253
+ };
14254
+ describe('#createIssueTypeScreenScheme - errors', () => {
14255
+ it('should work if integrated or standalone with mockdata', (done) => {
14256
+ try {
14257
+ a.createIssueTypeScreenScheme(issueTypeScreenSchemesCreateIssueTypeScreenSchemeBodyParam, (data, error) => {
14258
+ try {
14259
+ if (stub) {
14260
+ runCommonAsserts(data, error);
14261
+ assert.equal('10001', data.response.id);
14262
+ } else {
14263
+ runCommonAsserts(data, error);
14264
+ }
14265
+ saveMockData('IssueTypeScreenSchemes', 'createIssueTypeScreenScheme', 'default', data);
14266
+ done();
14267
+ } catch (err) {
14268
+ log.error(`Test Failure: ${err}`);
14269
+ done(err);
14270
+ }
14271
+ });
14272
+ } catch (error) {
14273
+ log.error(`Adapter Exception: ${error}`);
14274
+ done(error);
14275
+ }
14276
+ }).timeout(attemptTimeout);
14277
+ });
14278
+
14279
+ describe('#getIssueTypeScreenSchemeMappings - errors', () => {
14280
+ it('should work if integrated or standalone with mockdata', (done) => {
14281
+ try {
14282
+ a.getIssueTypeScreenSchemeMappings(null, null, null, (data, error) => {
14283
+ try {
14284
+ if (stub) {
14285
+ runCommonAsserts(data, error);
14286
+ assert.equal(100, data.response.maxResults);
14287
+ assert.equal(0, data.response.startAt);
14288
+ assert.equal(4, data.response.total);
14289
+ assert.equal(true, data.response.isLast);
14290
+ assert.equal(true, Array.isArray(data.response.values));
14291
+ } else {
14292
+ runCommonAsserts(data, error);
14293
+ }
14294
+ saveMockData('IssueTypeScreenSchemes', 'getIssueTypeScreenSchemeMappings', 'default', data);
14295
+ done();
14296
+ } catch (err) {
14297
+ log.error(`Test Failure: ${err}`);
14298
+ done(err);
14299
+ }
14300
+ });
14301
+ } catch (error) {
14302
+ log.error(`Adapter Exception: ${error}`);
14303
+ done(error);
14304
+ }
14305
+ }).timeout(attemptTimeout);
14306
+ });
14307
+
14308
+ describe('#getIssueTypeScreenSchemeProjectAssociations - errors', () => {
14309
+ it('should work if integrated or standalone with mockdata', (done) => {
14310
+ try {
14311
+ a.getIssueTypeScreenSchemeProjectAssociations(null, null, [], (data, error) => {
14312
+ try {
14313
+ if (stub) {
14314
+ runCommonAsserts(data, error);
14315
+ assert.equal(100, data.response.maxResults);
14316
+ assert.equal(0, data.response.startAt);
14317
+ assert.equal(1, data.response.total);
14318
+ assert.equal(true, data.response.isLast);
14319
+ assert.equal(true, Array.isArray(data.response.values));
14320
+ } else {
14321
+ runCommonAsserts(data, error);
14322
+ }
14323
+ saveMockData('IssueTypeScreenSchemes', 'getIssueTypeScreenSchemeProjectAssociations', 'default', data);
14324
+ done();
14325
+ } catch (err) {
14326
+ log.error(`Test Failure: ${err}`);
14327
+ done(err);
14328
+ }
14329
+ });
14330
+ } catch (error) {
14331
+ log.error(`Adapter Exception: ${error}`);
14332
+ done(error);
14333
+ }
14334
+ }).timeout(attemptTimeout);
14335
+ });
14336
+
14337
+ const issueTypeScreenSchemesAssignIssueTypeScreenSchemeToProjectBodyParam = {
14338
+ issueTypeScreenSchemeId: 'string',
14339
+ projectId: 'string'
14340
+ };
14341
+ describe('#assignIssueTypeScreenSchemeToProject - errors', () => {
14342
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14343
+ try {
14344
+ a.assignIssueTypeScreenSchemeToProject(issueTypeScreenSchemesAssignIssueTypeScreenSchemeToProjectBodyParam, (data, error) => {
14345
+ try {
14346
+ if (stub) {
14347
+ const displayE = 'Error 400 received on request';
14348
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14349
+ } else {
14350
+ runCommonAsserts(data, error);
14351
+ }
14352
+ saveMockData('IssueTypeScreenSchemes', 'assignIssueTypeScreenSchemeToProject', 'default', data);
14353
+ done();
14354
+ } catch (err) {
14355
+ log.error(`Test Failure: ${err}`);
14356
+ done(err);
14357
+ }
14358
+ });
14359
+ } catch (error) {
14360
+ log.error(`Adapter Exception: ${error}`);
14361
+ done(error);
14362
+ }
14363
+ }).timeout(attemptTimeout);
14364
+ });
14365
+
14366
+ const issueTypeScreenSchemesUpdateIssueTypeScreenSchemeBodyParam = {
14367
+ name: 'string',
14368
+ description: 'string'
14369
+ };
14370
+ describe('#updateIssueTypeScreenScheme - errors', () => {
14371
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14372
+ try {
14373
+ a.updateIssueTypeScreenScheme('fakedata', issueTypeScreenSchemesUpdateIssueTypeScreenSchemeBodyParam, (data, error) => {
14374
+ try {
14375
+ if (stub) {
14376
+ const displayE = 'Error 400 received on request';
14377
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14378
+ } else {
14379
+ runCommonAsserts(data, error);
14380
+ }
14381
+ saveMockData('IssueTypeScreenSchemes', 'updateIssueTypeScreenScheme', 'default', data);
14382
+ done();
14383
+ } catch (err) {
14384
+ log.error(`Test Failure: ${err}`);
14385
+ done(err);
14386
+ }
14387
+ });
14388
+ } catch (error) {
14389
+ log.error(`Adapter Exception: ${error}`);
14390
+ done(error);
14391
+ }
14392
+ }).timeout(attemptTimeout);
14393
+ });
14394
+
14395
+ describe('#deleteIssueTypeScreenScheme - errors', () => {
14396
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14397
+ try {
14398
+ a.deleteIssueTypeScreenScheme('fakedata', (data, error) => {
14399
+ try {
14400
+ if (stub) {
14401
+ const displayE = 'Error 400 received on request';
14402
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14403
+ } else {
14404
+ runCommonAsserts(data, error);
14405
+ }
14406
+ saveMockData('IssueTypeScreenSchemes', 'deleteIssueTypeScreenScheme', 'default', data);
14407
+ done();
14408
+ } catch (err) {
14409
+ log.error(`Test Failure: ${err}`);
14410
+ done(err);
14411
+ }
14412
+ });
14413
+ } catch (error) {
14414
+ log.error(`Adapter Exception: ${error}`);
14415
+ done(error);
14416
+ }
14417
+ }).timeout(attemptTimeout);
14418
+ });
14419
+
14420
+ const issueTypeScreenSchemesAppendMappingsForIssueTypeScreenSchemeBodyParam = {
14421
+ issueTypeMappings: [
14422
+ {}
14423
+ ]
14424
+ };
14425
+ describe('#appendMappingsForIssueTypeScreenScheme - errors', () => {
14426
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14427
+ try {
14428
+ a.appendMappingsForIssueTypeScreenScheme('fakedata', issueTypeScreenSchemesAppendMappingsForIssueTypeScreenSchemeBodyParam, (data, error) => {
14429
+ try {
14430
+ if (stub) {
14431
+ const displayE = 'Error 400 received on request';
14432
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14433
+ } else {
14434
+ runCommonAsserts(data, error);
14435
+ }
14436
+ saveMockData('IssueTypeScreenSchemes', 'appendMappingsForIssueTypeScreenScheme', 'default', data);
14437
+ done();
14438
+ } catch (err) {
14439
+ log.error(`Test Failure: ${err}`);
14440
+ done(err);
14441
+ }
14442
+ });
14443
+ } catch (error) {
14444
+ log.error(`Adapter Exception: ${error}`);
14445
+ done(error);
14446
+ }
14447
+ }).timeout(attemptTimeout);
14448
+ });
14449
+
14450
+ const issueTypeScreenSchemesUpdateDefaultScreenSchemeBodyParam = {
14451
+ screenSchemeId: 'string'
14452
+ };
14453
+ describe('#updateDefaultScreenScheme - errors', () => {
14454
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14455
+ try {
14456
+ a.updateDefaultScreenScheme('fakedata', issueTypeScreenSchemesUpdateDefaultScreenSchemeBodyParam, (data, error) => {
14457
+ try {
14458
+ if (stub) {
14459
+ const displayE = 'Error 400 received on request';
14460
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14461
+ } else {
14462
+ runCommonAsserts(data, error);
14463
+ }
14464
+ saveMockData('IssueTypeScreenSchemes', 'updateDefaultScreenScheme', 'default', data);
14465
+ done();
14466
+ } catch (err) {
14467
+ log.error(`Test Failure: ${err}`);
14468
+ done(err);
14469
+ }
14470
+ });
14471
+ } catch (error) {
14472
+ log.error(`Adapter Exception: ${error}`);
14473
+ done(error);
14474
+ }
14475
+ }).timeout(attemptTimeout);
14476
+ });
14477
+
14478
+ const issueTypeScreenSchemesRemoveMappingsFromIssueTypeScreenSchemeBodyParam = {
14479
+ issueTypeIds: [
14480
+ 'string'
14481
+ ]
14482
+ };
14483
+ describe('#removeMappingsFromIssueTypeScreenScheme - errors', () => {
14484
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14485
+ try {
14486
+ a.removeMappingsFromIssueTypeScreenScheme('fakedata', issueTypeScreenSchemesRemoveMappingsFromIssueTypeScreenSchemeBodyParam, (data, error) => {
14487
+ try {
14488
+ if (stub) {
14489
+ const displayE = 'Error 400 received on request';
14490
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14491
+ } else {
14492
+ runCommonAsserts(data, error);
14493
+ }
14494
+ saveMockData('IssueTypeScreenSchemes', 'removeMappingsFromIssueTypeScreenScheme', 'default', data);
14495
+ done();
14496
+ } catch (err) {
14497
+ log.error(`Test Failure: ${err}`);
14498
+ done(err);
14499
+ }
14500
+ });
14501
+ } catch (error) {
14502
+ log.error(`Adapter Exception: ${error}`);
14503
+ done(error);
14504
+ }
14505
+ }).timeout(attemptTimeout);
14506
+ });
14507
+
14508
+ describe('#getProjectsForIssueTypeScreenScheme - errors', () => {
14509
+ it('should work if integrated or standalone with mockdata', (done) => {
14510
+ try {
14511
+ a.getProjectsForIssueTypeScreenScheme(555, null, null, (data, error) => {
14512
+ try {
14513
+ if (stub) {
14514
+ runCommonAsserts(data, error);
14515
+ assert.equal(100, data.response.maxResults);
14516
+ assert.equal(0, data.response.startAt);
14517
+ assert.equal(1, data.response.total);
14518
+ assert.equal(true, data.response.isLast);
14519
+ assert.equal(true, Array.isArray(data.response.values));
14520
+ } else {
14521
+ runCommonAsserts(data, error);
14522
+ }
14523
+ saveMockData('IssueTypeScreenSchemes', 'getProjectsForIssueTypeScreenScheme', 'default', data);
14524
+ done();
14525
+ } catch (err) {
14526
+ log.error(`Test Failure: ${err}`);
14527
+ done(err);
14528
+ }
14529
+ });
14530
+ } catch (error) {
14531
+ log.error(`Adapter Exception: ${error}`);
14532
+ done(error);
14533
+ }
14534
+ }).timeout(attemptTimeout);
14535
+ });
14536
+
14537
+ const jQLGetAutoCompletePostBodyParam = {
14538
+ projectIds: [
14539
+ 9
14540
+ ],
14541
+ includeCollapsedFields: false
14542
+ };
14543
+ describe('#getAutoCompletePost - errors', () => {
14544
+ it('should work if integrated or standalone with mockdata', (done) => {
14545
+ try {
14546
+ a.getAutoCompletePost(jQLGetAutoCompletePostBodyParam, (data, error) => {
14547
+ try {
14548
+ if (stub) {
14549
+ runCommonAsserts(data, error);
14550
+ assert.equal(true, Array.isArray(data.response.visibleFieldNames));
14551
+ assert.equal(true, Array.isArray(data.response.visibleFunctionNames));
14552
+ assert.equal(true, Array.isArray(data.response.jqlReservedWords));
14553
+ } else {
14554
+ runCommonAsserts(data, error);
14555
+ }
14556
+ saveMockData('JQL', 'getAutoCompletePost', 'default', data);
14557
+ done();
14558
+ } catch (err) {
14559
+ log.error(`Test Failure: ${err}`);
14560
+ done(err);
14561
+ }
14562
+ });
14563
+ } catch (error) {
14564
+ log.error(`Adapter Exception: ${error}`);
14565
+ done(error);
14566
+ }
14567
+ }).timeout(attemptTimeout);
14568
+ });
14569
+
14570
+ const jQLParseJqlQueriesBodyParam = {
14571
+ queries: [
14572
+ 'string'
14573
+ ]
14574
+ };
14575
+ describe('#parseJqlQueries - errors', () => {
14576
+ it('should work if integrated or standalone with mockdata', (done) => {
14577
+ try {
14578
+ a.parseJqlQueries(null, jQLParseJqlQueriesBodyParam, (data, error) => {
14579
+ try {
14580
+ if (stub) {
14581
+ runCommonAsserts(data, error);
14582
+ assert.equal(true, Array.isArray(data.response.queries));
14583
+ } else {
14584
+ runCommonAsserts(data, error);
14585
+ }
14586
+ saveMockData('JQL', 'parseJqlQueries', 'default', data);
14587
+ done();
14588
+ } catch (err) {
14589
+ log.error(`Test Failure: ${err}`);
14590
+ done(err);
14591
+ }
14592
+ });
14593
+ } catch (error) {
14594
+ log.error(`Adapter Exception: ${error}`);
14595
+ done(error);
14596
+ }
14597
+ }).timeout(attemptTimeout);
14598
+ });
14599
+
14600
+ const issueSearchMatchIssuesBodyParam = {
14601
+ jqls: [
14602
+ 'string'
14603
+ ],
14604
+ issueIds: [
14605
+ 1
14606
+ ]
14607
+ };
14608
+ describe('#matchIssues - errors', () => {
14609
+ it('should work if integrated or standalone with mockdata', (done) => {
14610
+ try {
14611
+ a.matchIssues(issueSearchMatchIssuesBodyParam, (data, error) => {
14612
+ try {
14613
+ if (stub) {
14614
+ runCommonAsserts(data, error);
14615
+ assert.equal(true, Array.isArray(data.response.matches));
14616
+ } else {
14617
+ runCommonAsserts(data, error);
14618
+ }
14619
+ saveMockData('IssueSearch', 'matchIssues', 'default', data);
14620
+ done();
14621
+ } catch (err) {
14622
+ log.error(`Test Failure: ${err}`);
14623
+ done(err);
14624
+ }
14625
+ });
14626
+ } catch (error) {
14627
+ log.error(`Adapter Exception: ${error}`);
14628
+ done(error);
14629
+ }
14630
+ }).timeout(attemptTimeout);
14631
+ });
14632
+
14633
+ describe('#getAllLabels - errors', () => {
14634
+ it('should work if integrated or standalone with mockdata', (done) => {
14635
+ try {
14636
+ a.getAllLabels(null, null, (data, error) => {
14637
+ try {
14638
+ if (stub) {
14639
+ runCommonAsserts(data, error);
14640
+ assert.equal(2, data.response.maxResults);
14641
+ assert.equal(0, data.response.startAt);
14642
+ assert.equal(100, data.response.total);
14643
+ assert.equal(false, data.response.isLast);
14644
+ assert.equal(true, Array.isArray(data.response.values));
14645
+ } else {
14646
+ runCommonAsserts(data, error);
14647
+ }
14648
+ saveMockData('Labels', 'getAllLabels', 'default', data);
14649
+ done();
14650
+ } catch (err) {
14651
+ log.error(`Test Failure: ${err}`);
14652
+ done(err);
14653
+ }
14654
+ });
14655
+ } catch (error) {
14656
+ log.error(`Adapter Exception: ${error}`);
14657
+ done(error);
14658
+ }
14659
+ }).timeout(attemptTimeout);
14660
+ });
14661
+
14662
+ describe('#getRecent - errors', () => {
14663
+ it('should work if integrated or standalone with mockdata', (done) => {
14664
+ try {
14665
+ a.getRecent(null, null, (data, error) => {
14666
+ try {
14667
+ if (stub) {
14668
+ runCommonAsserts(data, error);
14669
+ assert.equal('object', typeof data.response[0]);
14670
+ assert.equal('object', typeof data.response[1]);
14671
+ } else {
14672
+ runCommonAsserts(data, error);
14673
+ }
14674
+ saveMockData('Projects', 'getRecent', 'default', data);
14675
+ done();
14676
+ } catch (err) {
14677
+ log.error(`Test Failure: ${err}`);
14678
+ done(err);
14679
+ }
14680
+ });
14681
+ } catch (error) {
14682
+ log.error(`Adapter Exception: ${error}`);
14683
+ done(error);
14684
+ }
14685
+ }).timeout(attemptTimeout);
14686
+ });
14687
+
14688
+ describe('#archiveProject - errors', () => {
14689
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14690
+ try {
14691
+ a.archiveProject('fakedata', (data, error) => {
14692
+ try {
14693
+ if (stub) {
14694
+ const displayE = 'Error 400 received on request';
14695
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14696
+ } else {
14697
+ runCommonAsserts(data, error);
14698
+ }
14699
+ saveMockData('Projects', 'archiveProject', 'default', data);
14700
+ done();
14701
+ } catch (err) {
14702
+ log.error(`Test Failure: ${err}`);
14703
+ done(err);
14704
+ }
14705
+ });
14706
+ } catch (error) {
14707
+ log.error(`Adapter Exception: ${error}`);
14708
+ done(error);
14709
+ }
14710
+ }).timeout(attemptTimeout);
14711
+ });
14712
+
14713
+ describe('#deleteProjectAsynchronously - errors', () => {
14714
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14715
+ try {
14716
+ a.deleteProjectAsynchronously('fakedata', (data, error) => {
14717
+ try {
14718
+ if (stub) {
14719
+ const displayE = 'Error 400 received on request';
14720
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14721
+ } else {
14722
+ runCommonAsserts(data, error);
14723
+ }
14724
+ saveMockData('Projects', 'deleteProjectAsynchronously', 'default', data);
14725
+ done();
14726
+ } catch (err) {
14727
+ log.error(`Test Failure: ${err}`);
14728
+ done(err);
14729
+ }
14730
+ });
14731
+ } catch (error) {
14732
+ log.error(`Adapter Exception: ${error}`);
14733
+ done(error);
14734
+ }
14735
+ }).timeout(attemptTimeout);
14736
+ });
14737
+
14738
+ describe('#restore - errors', () => {
14739
+ it('should work if integrated or standalone with mockdata', (done) => {
14740
+ try {
14741
+ a.restore('fakedata', (data, error) => {
14742
+ try {
14743
+ if (stub) {
14744
+ runCommonAsserts(data, error);
14745
+ assert.equal('https://your-domain.atlassian.net/rest/api/3/project/EX', data.response.self);
14746
+ assert.equal('10000', data.response.id);
14747
+ assert.equal('EX', data.response.key);
14748
+ assert.equal('This project was created as an example for REST.', data.response.description);
14749
+ assert.equal('object', typeof data.response.lead);
14750
+ assert.equal(true, Array.isArray(data.response.components));
14751
+ assert.equal(true, Array.isArray(data.response.issueTypes));
14752
+ assert.equal('https://www.example.com', data.response.url);
14753
+ assert.equal('from-jira@example.com', data.response.email);
14754
+ assert.equal('PROJECT_LEAD', data.response.assigneeType);
14755
+ assert.equal(true, Array.isArray(data.response.versions));
14756
+ assert.equal('Example', data.response.name);
14757
+ assert.equal('object', typeof data.response.roles);
14758
+ assert.equal('object', typeof data.response.avatarUrls);
14759
+ assert.equal('object', typeof data.response.projectCategory);
14760
+ assert.equal(false, data.response.simplified);
14761
+ assert.equal('classic', data.response.style);
14762
+ assert.equal('object', typeof data.response.properties);
14763
+ assert.equal('object', typeof data.response.insight);
14764
+ } else {
14765
+ runCommonAsserts(data, error);
14766
+ }
14767
+ saveMockData('Projects', 'restore', 'default', data);
14768
+ done();
14769
+ } catch (err) {
14770
+ log.error(`Test Failure: ${err}`);
14771
+ done(err);
14772
+ }
14773
+ });
14774
+ } catch (error) {
14775
+ log.error(`Adapter Exception: ${error}`);
14776
+ done(error);
14777
+ }
14778
+ }).timeout(attemptTimeout);
14779
+ });
14780
+
14781
+ describe('#getHierarchy - errors', () => {
14782
+ it('should work if integrated or standalone with mockdata', (done) => {
14783
+ try {
14784
+ a.getHierarchy(555, (data, error) => {
14785
+ try {
14786
+ if (stub) {
14787
+ runCommonAsserts(data, error);
14788
+ assert.equal(10030, data.response.projectId);
14789
+ assert.equal(true, Array.isArray(data.response.hierarchy));
14790
+ } else {
14791
+ runCommonAsserts(data, error);
14792
+ }
14793
+ saveMockData('Projects', 'getHierarchy', 'default', data);
14794
+ done();
14795
+ } catch (err) {
14796
+ log.error(`Test Failure: ${err}`);
14797
+ done(err);
14798
+ }
14799
+ });
14800
+ } catch (error) {
14801
+ log.error(`Adapter Exception: ${error}`);
14802
+ done(error);
14803
+ }
14804
+ }).timeout(attemptTimeout);
14805
+ });
14806
+
14807
+ describe('#getAllAccessibleProjectTypes - errors', () => {
14808
+ it('should work if integrated or standalone with mockdata', (done) => {
14809
+ try {
14810
+ a.getAllAccessibleProjectTypes((data, error) => {
14811
+ try {
14812
+ if (stub) {
14813
+ runCommonAsserts(data, error);
14814
+ assert.equal('object', typeof data.response[0]);
14815
+ assert.equal('object', typeof data.response[1]);
14816
+ } else {
14817
+ runCommonAsserts(data, error);
14818
+ }
14819
+ saveMockData('ProjectTypes', 'getAllAccessibleProjectTypes', 'default', data);
14820
+ done();
14821
+ } catch (err) {
14822
+ log.error(`Test Failure: ${err}`);
14823
+ done(err);
14824
+ }
14825
+ });
14826
+ } catch (error) {
14827
+ log.error(`Adapter Exception: ${error}`);
14828
+ done(error);
14829
+ }
14830
+ }).timeout(attemptTimeout);
14831
+ });
14832
+
14833
+ describe('#getFeaturesForProject - errors', () => {
14834
+ it('should work if integrated or standalone with mockdata', (done) => {
14835
+ try {
14836
+ a.getFeaturesForProject('fakedata', (data, error) => {
14837
+ try {
14838
+ if (stub) {
14839
+ runCommonAsserts(data, error);
14840
+ assert.equal(true, Array.isArray(data.response.features));
14841
+ } else {
14842
+ runCommonAsserts(data, error);
14843
+ }
14844
+ saveMockData('ProjectFeatures', 'getFeaturesForProject', 'default', data);
14845
+ done();
14846
+ } catch (err) {
14847
+ log.error(`Test Failure: ${err}`);
14848
+ done(err);
14849
+ }
14850
+ });
14851
+ } catch (error) {
14852
+ log.error(`Adapter Exception: ${error}`);
14853
+ done(error);
14854
+ }
14855
+ }).timeout(attemptTimeout);
14856
+ });
14857
+
14858
+ const projectFeaturesToggleFeatureForProjectBodyParam = {
14859
+ state: 'COMING_SOON'
14860
+ };
14861
+ describe('#toggleFeatureForProject - errors', () => {
14862
+ it('should work if integrated or standalone with mockdata', (done) => {
14863
+ try {
14864
+ a.toggleFeatureForProject('fakedata', 'fakedata', projectFeaturesToggleFeatureForProjectBodyParam, (data, error) => {
14865
+ try {
14866
+ if (stub) {
14867
+ runCommonAsserts(data, error);
14868
+ assert.equal('success', data.response);
14869
+ } else {
14870
+ runCommonAsserts(data, error);
14871
+ }
14872
+ saveMockData('ProjectFeatures', 'toggleFeatureForProject', 'default', data);
14873
+ done();
14874
+ } catch (err) {
14875
+ log.error(`Test Failure: ${err}`);
14876
+ done(err);
14877
+ }
14878
+ });
14879
+ } catch (error) {
14880
+ log.error(`Adapter Exception: ${error}`);
14881
+ done(error);
14882
+ }
14883
+ }).timeout(attemptTimeout);
14884
+ });
14885
+
14886
+ describe('#getProjectEmail - errors', () => {
14887
+ it('should work if integrated or standalone with mockdata', (done) => {
14888
+ try {
14889
+ a.getProjectEmail(555, (data, error) => {
14890
+ try {
14891
+ if (stub) {
14892
+ runCommonAsserts(data, error);
14893
+ assert.equal('jira@example.customdomain.com', data.response.emailAddress);
14894
+ assert.equal(true, Array.isArray(data.response.emailAddressStatus));
14895
+ } else {
14896
+ runCommonAsserts(data, error);
14897
+ }
14898
+ saveMockData('ProjectEmail', 'getProjectEmail', 'default', data);
14899
+ done();
14900
+ } catch (err) {
14901
+ log.error(`Test Failure: ${err}`);
14902
+ done(err);
14903
+ }
14904
+ });
14905
+ } catch (error) {
14906
+ log.error(`Adapter Exception: ${error}`);
14907
+ done(error);
14908
+ }
14909
+ }).timeout(attemptTimeout);
14910
+ });
14911
+
14912
+ const projectEmailUpdateProjectEmailBodyParam = {
14913
+ emailAddress: 'string',
14914
+ emailAddressStatus: [
14915
+ 'string'
14916
+ ]
14917
+ };
14918
+ describe('#updateProjectEmail - errors', () => {
14919
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
14920
+ try {
14921
+ a.updateProjectEmail(555, projectEmailUpdateProjectEmailBodyParam, (data, error) => {
14922
+ try {
14923
+ if (stub) {
14924
+ const displayE = 'Error 400 received on request';
14925
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
14926
+ } else {
14927
+ runCommonAsserts(data, error);
14928
+ }
14929
+ saveMockData('ProjectEmail', 'updateProjectEmail', 'default', data);
14930
+ done();
14931
+ } catch (err) {
14932
+ log.error(`Test Failure: ${err}`);
14933
+ done(err);
14934
+ }
14935
+ });
14936
+ } catch (error) {
14937
+ log.error(`Adapter Exception: ${error}`);
14938
+ done(error);
14939
+ }
14940
+ }).timeout(attemptTimeout);
14941
+ });
14942
+
14943
+ describe('#getScreenSchemes - errors', () => {
14944
+ it('should work if integrated or standalone with mockdata', (done) => {
14945
+ try {
14946
+ a.getScreenSchemes(null, null, null, (data, error) => {
14947
+ try {
14948
+ if (stub) {
14949
+ runCommonAsserts(data, error);
14950
+ assert.equal('https://your-domain.atlassian.net/rest/api/3/screenscheme?maxResults=25&startAt=0', data.response.self);
14951
+ assert.equal(100, data.response.maxResults);
14952
+ assert.equal(0, data.response.startAt);
14953
+ assert.equal(2, data.response.total);
14954
+ assert.equal(true, data.response.isLast);
14955
+ assert.equal(true, Array.isArray(data.response.values));
14956
+ } else {
14957
+ runCommonAsserts(data, error);
14958
+ }
14959
+ saveMockData('ScreenSchemes', 'getScreenSchemes', 'default', data);
14960
+ done();
14961
+ } catch (err) {
14962
+ log.error(`Test Failure: ${err}`);
14963
+ done(err);
14964
+ }
14965
+ });
14966
+ } catch (error) {
14967
+ log.error(`Adapter Exception: ${error}`);
14968
+ done(error);
14969
+ }
14970
+ }).timeout(attemptTimeout);
14971
+ });
14972
+
14973
+ const screenSchemesCreateScreenSchemeBodyParam = {
14974
+ name: 'string',
14975
+ screens: {}
14976
+ };
14977
+ describe('#createScreenScheme - errors', () => {
14978
+ it('should work if integrated or standalone with mockdata', (done) => {
14979
+ try {
14980
+ a.createScreenScheme(screenSchemesCreateScreenSchemeBodyParam, (data, error) => {
14981
+ try {
14982
+ if (stub) {
14983
+ runCommonAsserts(data, error);
14984
+ assert.equal(10001, data.response.id);
14985
+ } else {
14986
+ runCommonAsserts(data, error);
14987
+ }
14988
+ saveMockData('ScreenSchemes', 'createScreenScheme', 'default', data);
14989
+ done();
14990
+ } catch (err) {
14991
+ log.error(`Test Failure: ${err}`);
14992
+ done(err);
14993
+ }
14994
+ });
14995
+ } catch (error) {
14996
+ log.error(`Adapter Exception: ${error}`);
14997
+ done(error);
14998
+ }
14999
+ }).timeout(attemptTimeout);
15000
+ });
15001
+
15002
+ const screenSchemesUpdateScreenSchemeBodyParam = {
15003
+ name: 'string',
15004
+ description: 'string',
15005
+ screens: {
15006
+ edit: 'string',
15007
+ create: 'string',
15008
+ view: 'string',
15009
+ default: 'string'
15010
+ }
15011
+ };
15012
+ describe('#updateScreenScheme - errors', () => {
15013
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
15014
+ try {
15015
+ a.updateScreenScheme('fakedata', screenSchemesUpdateScreenSchemeBodyParam, (data, error) => {
15016
+ try {
15017
+ if (stub) {
15018
+ const displayE = 'Error 400 received on request';
15019
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
15020
+ } else {
15021
+ runCommonAsserts(data, error);
15022
+ }
15023
+ saveMockData('ScreenSchemes', 'updateScreenScheme', 'default', data);
15024
+ done();
15025
+ } catch (err) {
15026
+ log.error(`Test Failure: ${err}`);
15027
+ done(err);
15028
+ }
15029
+ });
15030
+ } catch (error) {
15031
+ log.error(`Adapter Exception: ${error}`);
15032
+ done(error);
15033
+ }
15034
+ }).timeout(attemptTimeout);
15035
+ });
15036
+
15037
+ describe('#deleteScreenScheme - errors', () => {
15038
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
15039
+ try {
15040
+ a.deleteScreenScheme('fakedata', (data, error) => {
15041
+ try {
15042
+ if (stub) {
15043
+ const displayE = 'Error 400 received on request';
15044
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
15045
+ } else {
15046
+ runCommonAsserts(data, error);
15047
+ }
15048
+ saveMockData('ScreenSchemes', 'deleteScreenScheme', 'default', data);
15049
+ done();
15050
+ } catch (err) {
15051
+ log.error(`Test Failure: ${err}`);
15052
+ done(err);
15053
+ }
15054
+ });
15055
+ } catch (error) {
15056
+ log.error(`Adapter Exception: ${error}`);
15057
+ done(error);
15058
+ }
15059
+ }).timeout(attemptTimeout);
15060
+ });
15061
+
15062
+ describe('#getAvatarImageByType - errors', () => {
15063
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
15064
+ try {
15065
+ a.getAvatarImageByType('fakedata', null, null, (data, error) => {
15066
+ try {
15067
+ if (stub) {
15068
+ const displayE = 'Error 400 received on request';
15069
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
15070
+ } else {
15071
+ runCommonAsserts(data, error);
15072
+ }
15073
+ saveMockData('Avatars', 'getAvatarImageByType', 'default', data);
15074
+ done();
15075
+ } catch (err) {
15076
+ log.error(`Test Failure: ${err}`);
15077
+ done(err);
15078
+ }
15079
+ });
15080
+ } catch (error) {
15081
+ log.error(`Adapter Exception: ${error}`);
15082
+ done(error);
15083
+ }
15084
+ }).timeout(attemptTimeout);
15085
+ });
15086
+
15087
+ describe('#getAvatarImageByID - errors', () => {
15088
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
15089
+ try {
15090
+ a.getAvatarImageByID('fakedata', 555, null, null, (data, error) => {
15091
+ try {
15092
+ if (stub) {
15093
+ const displayE = 'Error 400 received on request';
15094
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
15095
+ } else {
15096
+ runCommonAsserts(data, error);
15097
+ }
15098
+ saveMockData('Avatars', 'getAvatarImageByID', 'default', data);
15099
+ done();
15100
+ } catch (err) {
15101
+ log.error(`Test Failure: ${err}`);
15102
+ done(err);
15103
+ }
15104
+ });
15105
+ } catch (error) {
15106
+ log.error(`Adapter Exception: ${error}`);
15107
+ done(error);
15108
+ }
15109
+ }).timeout(attemptTimeout);
15110
+ });
15111
+
15112
+ describe('#getAvatarImageByOwner - errors', () => {
15113
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
15114
+ try {
15115
+ a.getAvatarImageByOwner('fakedata', 'fakedata', null, null, (data, error) => {
15116
+ try {
15117
+ if (stub) {
15118
+ const displayE = 'Error 400 received on request';
15119
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
15120
+ } else {
15121
+ runCommonAsserts(data, error);
15122
+ }
15123
+ saveMockData('Avatars', 'getAvatarImageByOwner', 'default', data);
15124
+ done();
15125
+ } catch (err) {
15126
+ log.error(`Test Failure: ${err}`);
15127
+ done(err);
15128
+ }
15129
+ });
15130
+ } catch (error) {
15131
+ log.error(`Adapter Exception: ${error}`);
15132
+ done(error);
15133
+ }
15134
+ }).timeout(attemptTimeout);
15135
+ });
15136
+
15137
+ describe('#getUserEmail - errors', () => {
15138
+ it('should work if integrated or standalone with mockdata', (done) => {
15139
+ try {
15140
+ a.getUserEmail('fakedata', (data, error) => {
15141
+ try {
15142
+ if (stub) {
15143
+ runCommonAsserts(data, error);
15144
+ } else {
15145
+ runCommonAsserts(data, error);
15146
+ }
15147
+ saveMockData('Users', 'getUserEmail', 'default', data);
15148
+ done();
15149
+ } catch (err) {
15150
+ log.error(`Test Failure: ${err}`);
15151
+ done(err);
15152
+ }
15153
+ });
15154
+ } catch (error) {
15155
+ log.error(`Adapter Exception: ${error}`);
15156
+ done(error);
15157
+ }
15158
+ }).timeout(attemptTimeout);
15159
+ });
15160
+
15161
+ describe('#getUserEmailBulk - errors', () => {
15162
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
15163
+ try {
15164
+ a.getUserEmailBulk([], (data, error) => {
15165
+ try {
15166
+ if (stub) {
15167
+ const displayE = 'Error 400 received on request';
15168
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
15169
+ } else {
15170
+ runCommonAsserts(data, error);
15171
+ }
15172
+ saveMockData('Users', 'getUserEmailBulk', 'default', data);
15173
+ done();
15174
+ } catch (err) {
15175
+ log.error(`Test Failure: ${err}`);
15176
+ done(err);
15177
+ }
15178
+ });
15179
+ } catch (error) {
15180
+ log.error(`Adapter Exception: ${error}`);
15181
+ done(error);
15182
+ }
15183
+ }).timeout(attemptTimeout);
15184
+ });
15185
+
15186
+ describe('#getAllUsersDefault - errors', () => {
15187
+ it('should work if integrated or standalone with mockdata', (done) => {
15188
+ try {
15189
+ a.getAllUsersDefault(null, null, (data, error) => {
15190
+ try {
15191
+ if (stub) {
15192
+ runCommonAsserts(data, error);
15193
+ assert.equal('object', typeof data.response[0]);
15194
+ assert.equal('object', typeof data.response[1]);
15195
+ } else {
15196
+ runCommonAsserts(data, error);
15197
+ }
15198
+ saveMockData('Users', 'getAllUsersDefault', 'default', data);
15199
+ done();
15200
+ } catch (err) {
15201
+ log.error(`Test Failure: ${err}`);
15202
+ done(err);
15203
+ }
15204
+ });
15205
+ } catch (error) {
15206
+ log.error(`Adapter Exception: ${error}`);
15207
+ done(error);
15208
+ }
15209
+ }).timeout(attemptTimeout);
15210
+ });
15211
+
15212
+ describe('#getAllUsers - errors', () => {
15213
+ it('should work if integrated or standalone with mockdata', (done) => {
15214
+ try {
15215
+ a.getAllUsers(null, null, (data, error) => {
15216
+ try {
15217
+ if (stub) {
15218
+ runCommonAsserts(data, error);
15219
+ assert.equal('object', typeof data.response[0]);
15220
+ assert.equal('object', typeof data.response[1]);
15221
+ } else {
15222
+ runCommonAsserts(data, error);
15223
+ }
15224
+ saveMockData('Users', 'getAllUsers', 'default', data);
15225
+ done();
15226
+ } catch (err) {
15227
+ log.error(`Test Failure: ${err}`);
15228
+ done(err);
15229
+ }
15230
+ });
15231
+ } catch (error) {
15232
+ log.error(`Adapter Exception: ${error}`);
15233
+ done(error);
15234
+ }
15235
+ }).timeout(attemptTimeout);
15236
+ });
15237
+
15238
+ describe('#getDynamicWebhooksForApp - errors', () => {
15239
+ it('should work if integrated or standalone with mockdata', (done) => {
15240
+ try {
15241
+ a.getDynamicWebhooksForApp(null, null, (data, error) => {
15242
+ try {
15243
+ if (stub) {
15244
+ runCommonAsserts(data, error);
15245
+ assert.equal(3, data.response.maxResults);
15246
+ assert.equal(0, data.response.startAt);
15247
+ assert.equal(3, data.response.total);
15248
+ assert.equal(true, data.response.isLast);
15249
+ assert.equal(true, Array.isArray(data.response.values));
15250
+ } else {
15251
+ runCommonAsserts(data, error);
15252
+ }
15253
+ saveMockData('Webhooks', 'getDynamicWebhooksForApp', 'default', data);
15254
+ done();
15255
+ } catch (err) {
15256
+ log.error(`Test Failure: ${err}`);
15257
+ done(err);
15258
+ }
15259
+ });
15260
+ } catch (error) {
15261
+ log.error(`Adapter Exception: ${error}`);
15262
+ done(error);
15263
+ }
15264
+ }).timeout(attemptTimeout);
15265
+ });
15266
+
15267
+ const webhooksRegisterDynamicWebhooksBodyParam = {
15268
+ webhooks: [
15269
+ {}
15270
+ ],
15271
+ url: 'string'
15272
+ };
15273
+ describe('#registerDynamicWebhooks - errors', () => {
15274
+ it('should work if integrated or standalone with mockdata', (done) => {
15275
+ try {
15276
+ a.registerDynamicWebhooks(webhooksRegisterDynamicWebhooksBodyParam, (data, error) => {
15277
+ try {
15278
+ if (stub) {
15279
+ runCommonAsserts(data, error);
15280
+ assert.equal(true, Array.isArray(data.response.webhookRegistrationResult));
15281
+ } else {
15282
+ runCommonAsserts(data, error);
15283
+ }
15284
+ saveMockData('Webhooks', 'registerDynamicWebhooks', 'default', data);
15285
+ done();
15286
+ } catch (err) {
15287
+ log.error(`Test Failure: ${err}`);
15288
+ done(err);
15289
+ }
15290
+ });
15291
+ } catch (error) {
15292
+ log.error(`Adapter Exception: ${error}`);
15293
+ done(error);
15294
+ }
15295
+ }).timeout(attemptTimeout);
15296
+ });
15297
+
15298
+ const webhooksDeleteWebhookByIdBodyParam = {
15299
+ webhookIds: [
15300
+ 4
15301
+ ]
15302
+ };
15303
+ describe('#deleteWebhookById - errors', () => {
15304
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
15305
+ try {
15306
+ a.deleteWebhookById(webhooksDeleteWebhookByIdBodyParam, (data, error) => {
15307
+ try {
15308
+ if (stub) {
15309
+ const displayE = 'Error 400 received on request';
15310
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
15311
+ } else {
15312
+ runCommonAsserts(data, error);
15313
+ }
15314
+ saveMockData('Webhooks', 'deleteWebhookById', 'default', data);
15315
+ done();
15316
+ } catch (err) {
15317
+ log.error(`Test Failure: ${err}`);
15318
+ done(err);
15319
+ }
15320
+ });
15321
+ } catch (error) {
15322
+ log.error(`Adapter Exception: ${error}`);
15323
+ done(error);
15324
+ }
15325
+ }).timeout(attemptTimeout);
15326
+ });
15327
+
15328
+ describe('#getFailedWebhooks - errors', () => {
15329
+ it('should work if integrated or standalone with mockdata', (done) => {
15330
+ try {
15331
+ a.getFailedWebhooks(null, null, (data, error) => {
15332
+ try {
15333
+ if (stub) {
15334
+ runCommonAsserts(data, error);
15335
+ assert.equal(true, Array.isArray(data.response.values));
15336
+ assert.equal(100, data.response.maxResults);
15337
+ assert.equal('https://your-domain.atlassian.net/rest/api/3/webhook/failed?failedAfter=1573540473480&maxResults=100', data.response.next);
15338
+ } else {
15339
+ runCommonAsserts(data, error);
15340
+ }
15341
+ saveMockData('Webhooks', 'getFailedWebhooks', 'default', data);
15342
+ done();
15343
+ } catch (err) {
15344
+ log.error(`Test Failure: ${err}`);
15345
+ done(err);
15346
+ }
15347
+ });
15348
+ } catch (error) {
15349
+ log.error(`Adapter Exception: ${error}`);
15350
+ done(error);
15351
+ }
15352
+ }).timeout(attemptTimeout);
15353
+ });
15354
+
15355
+ const webhooksRefreshWebhooksBodyParam = {
15356
+ webhookIds: [
15357
+ 8
15358
+ ]
15359
+ };
15360
+ describe('#refreshWebhooks - errors', () => {
15361
+ it('should work if integrated or standalone with mockdata', (done) => {
15362
+ try {
15363
+ a.refreshWebhooks(webhooksRefreshWebhooksBodyParam, (data, error) => {
15364
+ try {
15365
+ if (stub) {
15366
+ runCommonAsserts(data, error);
15367
+ assert.equal('success', data.response);
15368
+ } else {
15369
+ runCommonAsserts(data, error);
15370
+ }
15371
+ saveMockData('Webhooks', 'refreshWebhooks', 'default', data);
15372
+ done();
15373
+ } catch (err) {
15374
+ log.error(`Test Failure: ${err}`);
15375
+ done(err);
15376
+ }
15377
+ });
15378
+ } catch (error) {
15379
+ log.error(`Adapter Exception: ${error}`);
15380
+ done(error);
15381
+ }
15382
+ }).timeout(attemptTimeout);
15383
+ });
15384
+
15385
+ const workflowsCreateWorkflowBodyParam = {
15386
+ name: 'string',
15387
+ transitions: [
15388
+ {
15389
+ name: 'string'
15390
+ }
15391
+ ],
15392
+ statuses: [
15393
+ {}
15394
+ ]
15395
+ };
15396
+ describe('#createWorkflow - errors', () => {
15397
+ it('should work if integrated or standalone with mockdata', (done) => {
15398
+ try {
15399
+ a.createWorkflow(workflowsCreateWorkflowBodyParam, (data, error) => {
15400
+ try {
15401
+ if (stub) {
15402
+ runCommonAsserts(data, error);
15403
+ assert.equal('Workflow 1', data.response.name);
15404
+ assert.equal('fb8731c5-aa05-4453-bf79-b583a1c87736', data.response.entityId);
15405
+ } else {
15406
+ runCommonAsserts(data, error);
15407
+ }
15408
+ saveMockData('Workflows', 'createWorkflow', 'default', data);
15409
+ done();
15410
+ } catch (err) {
15411
+ log.error(`Test Failure: ${err}`);
15412
+ done(err);
15413
+ }
15414
+ });
15415
+ } catch (error) {
15416
+ log.error(`Adapter Exception: ${error}`);
15417
+ done(error);
15418
+ }
15419
+ }).timeout(attemptTimeout);
15420
+ });
15421
+
15422
+ describe('#getWorkflowsPaginated - errors', () => {
15423
+ it('should work if integrated or standalone with mockdata', (done) => {
15424
+ try {
15425
+ a.getWorkflowsPaginated(null, null, null, null, null, null, null, (data, error) => {
15426
+ try {
15427
+ if (stub) {
15428
+ runCommonAsserts(data, error);
15429
+ assert.equal(1, data.response.maxResults);
15430
+ assert.equal(0, data.response.startAt);
15431
+ assert.equal(5, data.response.total);
15432
+ assert.equal(false, data.response.isLast);
15433
+ assert.equal(true, Array.isArray(data.response.values));
15434
+ } else {
15435
+ runCommonAsserts(data, error);
15436
+ }
15437
+ saveMockData('Workflows', 'getWorkflowsPaginated', 'default', data);
15438
+ done();
15439
+ } catch (err) {
15440
+ log.error(`Test Failure: ${err}`);
15441
+ done(err);
15442
+ }
15443
+ });
15444
+ } catch (error) {
15445
+ log.error(`Adapter Exception: ${error}`);
15446
+ done(error);
15447
+ }
15448
+ }).timeout(attemptTimeout);
15449
+ });
15450
+
15451
+ describe('#deleteInactiveWorkflow - errors', () => {
15452
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
15453
+ try {
15454
+ a.deleteInactiveWorkflow('fakedata', (data, error) => {
15455
+ try {
15456
+ if (stub) {
15457
+ const displayE = 'Error 400 received on request';
15458
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
15459
+ } else {
15460
+ runCommonAsserts(data, error);
15461
+ }
15462
+ saveMockData('Workflows', 'deleteInactiveWorkflow', 'default', data);
15463
+ done();
15464
+ } catch (err) {
15465
+ log.error(`Test Failure: ${err}`);
15466
+ done(err);
15467
+ }
15468
+ });
15469
+ } catch (error) {
15470
+ log.error(`Adapter Exception: ${error}`);
15471
+ done(error);
15472
+ }
15473
+ }).timeout(attemptTimeout);
15474
+ });
15475
+
15476
+ describe('#getWorkflowTransitionRuleConfigurations - errors', () => {
15477
+ it('should work if integrated or standalone with mockdata', (done) => {
15478
+ try {
15479
+ a.getWorkflowTransitionRuleConfigurations(null, null, [], null, null, null, null, null, (data, error) => {
15480
+ try {
15481
+ if (stub) {
15482
+ runCommonAsserts(data, error);
15483
+ assert.equal(10, data.response.maxResults);
15484
+ assert.equal(0, data.response.startAt);
15485
+ assert.equal(1, data.response.total);
15486
+ assert.equal(true, data.response.isLast);
15487
+ assert.equal(true, Array.isArray(data.response.values));
15488
+ } else {
15489
+ runCommonAsserts(data, error);
15490
+ }
15491
+ saveMockData('WorkflowTransitionRules', 'getWorkflowTransitionRuleConfigurations', 'default', data);
15492
+ done();
15493
+ } catch (err) {
15494
+ log.error(`Test Failure: ${err}`);
15495
+ done(err);
15496
+ }
15497
+ });
15498
+ } catch (error) {
15499
+ log.error(`Adapter Exception: ${error}`);
15500
+ done(error);
15501
+ }
15502
+ }).timeout(attemptTimeout);
15503
+ });
15504
+
15505
+ const workflowTransitionRulesUpdateWorkflowTransitionRuleConfigurationsBodyParam = {
15506
+ workflows: [
15507
+ {}
15508
+ ]
15509
+ };
15510
+ describe('#updateWorkflowTransitionRuleConfigurations - errors', () => {
15511
+ it('should work if integrated or standalone with mockdata', (done) => {
15512
+ try {
15513
+ a.updateWorkflowTransitionRuleConfigurations(workflowTransitionRulesUpdateWorkflowTransitionRuleConfigurationsBodyParam, (data, error) => {
15514
+ try {
15515
+ if (stub) {
15516
+ runCommonAsserts(data, error);
15517
+ assert.equal('success', data.response);
15518
+ } else {
15519
+ runCommonAsserts(data, error);
15520
+ }
15521
+ saveMockData('WorkflowTransitionRules', 'updateWorkflowTransitionRuleConfigurations', 'default', data);
15522
+ done();
15523
+ } catch (err) {
15524
+ log.error(`Test Failure: ${err}`);
15525
+ done(err);
15526
+ }
15527
+ });
15528
+ } catch (error) {
15529
+ log.error(`Adapter Exception: ${error}`);
15530
+ done(error);
15531
+ }
15532
+ }).timeout(attemptTimeout);
15533
+ });
15534
+
15535
+ const workflowTransitionRulesDeleteWorkflowTransitionRuleConfigurationsBodyParam = {
15536
+ workflows: [
15537
+ {}
15538
+ ]
15539
+ };
15540
+ describe('#deleteWorkflowTransitionRuleConfigurations - errors', () => {
15541
+ it('should work if integrated or standalone with mockdata', (done) => {
15542
+ try {
15543
+ a.deleteWorkflowTransitionRuleConfigurations(workflowTransitionRulesDeleteWorkflowTransitionRuleConfigurationsBodyParam, (data, error) => {
15544
+ try {
15545
+ if (stub) {
15546
+ runCommonAsserts(data, error);
15547
+ assert.equal('success', data.response);
15548
+ } else {
15549
+ runCommonAsserts(data, error);
15550
+ }
15551
+ saveMockData('WorkflowTransitionRules', 'deleteWorkflowTransitionRuleConfigurations', 'default', data);
15552
+ done();
15553
+ } catch (err) {
15554
+ log.error(`Test Failure: ${err}`);
15555
+ done(err);
15556
+ }
15557
+ });
15558
+ } catch (error) {
15559
+ log.error(`Adapter Exception: ${error}`);
15560
+ done(error);
15561
+ }
15562
+ }).timeout(attemptTimeout);
15563
+ });
15564
+
15565
+ describe('#getAllWorkflowSchemes - errors', () => {
15566
+ it('should work if integrated or standalone with mockdata', (done) => {
15567
+ try {
15568
+ a.getAllWorkflowSchemes(null, null, (data, error) => {
15569
+ try {
15570
+ if (stub) {
15571
+ runCommonAsserts(data, error);
15572
+ assert.equal(50, data.response.maxResults);
15573
+ assert.equal(0, data.response.startAt);
15574
+ assert.equal(2, data.response.total);
15575
+ assert.equal(true, data.response.isLast);
15576
+ assert.equal(true, Array.isArray(data.response.values));
15577
+ } else {
15578
+ runCommonAsserts(data, error);
15579
+ }
15580
+ saveMockData('WorkflowSchemes', 'getAllWorkflowSchemes', 'default', data);
15581
+ done();
15582
+ } catch (err) {
15583
+ log.error(`Test Failure: ${err}`);
15584
+ done(err);
15585
+ }
15586
+ });
15587
+ } catch (error) {
15588
+ log.error(`Adapter Exception: ${error}`);
15589
+ done(error);
15590
+ }
15591
+ }).timeout(attemptTimeout);
15592
+ });
15593
+
15594
+ describe('#getWorkflowSchemeProjectAssociations - errors', () => {
15595
+ it('should work if integrated or standalone with mockdata', (done) => {
15596
+ try {
15597
+ a.getWorkflowSchemeProjectAssociations([], (data, error) => {
15598
+ try {
15599
+ if (stub) {
15600
+ runCommonAsserts(data, error);
15601
+ assert.equal(true, Array.isArray(data.response.values));
15602
+ } else {
15603
+ runCommonAsserts(data, error);
15604
+ }
15605
+ saveMockData('WorkflowSchemeProjectAssociations', 'getWorkflowSchemeProjectAssociations', 'default', data);
15606
+ done();
15607
+ } catch (err) {
15608
+ log.error(`Test Failure: ${err}`);
15609
+ done(err);
15610
+ }
15611
+ });
15612
+ } catch (error) {
15613
+ log.error(`Adapter Exception: ${error}`);
15614
+ done(error);
15615
+ }
15616
+ }).timeout(attemptTimeout);
15617
+ });
15618
+
15619
+ const workflowSchemeProjectAssociationsAssignSchemeToProjectBodyParam = {
15620
+ projectId: 'string'
15621
+ };
15622
+ describe('#assignSchemeToProject - errors', () => {
15623
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
15624
+ try {
15625
+ a.assignSchemeToProject(workflowSchemeProjectAssociationsAssignSchemeToProjectBodyParam, (data, error) => {
15626
+ try {
15627
+ if (stub) {
15628
+ const displayE = 'Error 400 received on request';
15629
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
15630
+ } else {
15631
+ runCommonAsserts(data, error);
15632
+ }
15633
+ saveMockData('WorkflowSchemeProjectAssociations', 'assignSchemeToProject', 'default', data);
15634
+ done();
15635
+ } catch (err) {
15636
+ log.error(`Test Failure: ${err}`);
15637
+ done(err);
15638
+ }
15639
+ });
15640
+ } catch (error) {
15641
+ log.error(`Adapter Exception: ${error}`);
15642
+ done(error);
15643
+ }
15644
+ }).timeout(attemptTimeout);
15645
+ });
15646
+
15647
+ const workflowSchemeDraftsPublishDraftWorkflowSchemeBodyParam = {
15648
+ statusMappings: [
15649
+ {
15650
+ issueTypeId: 'string',
15651
+ statusId: 'string',
15652
+ newStatusId: 'string'
15653
+ }
15654
+ ]
15655
+ };
15656
+ describe('#publishDraftWorkflowScheme - errors', () => {
15657
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
15658
+ try {
15659
+ a.publishDraftWorkflowScheme(555, null, workflowSchemeDraftsPublishDraftWorkflowSchemeBodyParam, (data, error) => {
15660
+ try {
15661
+ if (stub) {
15662
+ const displayE = 'Error 400 received on request';
15663
+ runErrorAsserts(data, error, 'AD.500', 'Test-jira-connectorRest-handleEndResponse', displayE);
15664
+ } else {
15665
+ runCommonAsserts(data, error);
15666
+ }
15667
+ saveMockData('WorkflowSchemeDrafts', 'publishDraftWorkflowScheme', 'default', data);
15668
+ done();
15669
+ } catch (err) {
15670
+ log.error(`Test Failure: ${err}`);
15671
+ done(err);
15672
+ }
15673
+ });
15674
+ } catch (error) {
15675
+ log.error(`Adapter Exception: ${error}`);
15676
+ done(error);
15677
+ }
15678
+ }).timeout(attemptTimeout);
15679
+ });
12153
15680
  });
12154
15681
  });