@ndustrial/contxt-sdk 5.5.7 → 5.6.1

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 (230) hide show
  1. package/.nvmrc +1 -1
  2. package/eslint.config.mjs +44 -0
  3. package/esm/bus/channels.js +1883 -216
  4. package/esm/bus/channels.js.map +1 -1
  5. package/esm/bus/index.browser.js +218 -37
  6. package/esm/bus/index.browser.js.map +1 -1
  7. package/esm/bus/index.js +906 -94
  8. package/esm/bus/index.js.map +1 -1
  9. package/esm/bus/webSocketConnection.browser.js +86 -12
  10. package/esm/bus/webSocketConnection.browser.js.map +1 -1
  11. package/esm/bus/webSocketConnection.js +2464 -332
  12. package/esm/bus/webSocketConnection.js.map +1 -1
  13. package/esm/config/audiences.js +37 -1
  14. package/esm/config/audiences.js.map +1 -1
  15. package/esm/config/defaults.js +37 -1
  16. package/esm/config/defaults.js.map +1 -1
  17. package/esm/config/index.js +1622 -203
  18. package/esm/config/index.js.map +1 -1
  19. package/esm/coordinator/applications.js +1019 -172
  20. package/esm/coordinator/applications.js.map +1 -1
  21. package/esm/coordinator/consent.js +603 -76
  22. package/esm/coordinator/consent.js.map +1 -1
  23. package/esm/coordinator/edgeNodes.js +520 -40
  24. package/esm/coordinator/edgeNodes.js.map +1 -1
  25. package/esm/coordinator/index.js +811 -54
  26. package/esm/coordinator/index.js.map +1 -1
  27. package/esm/coordinator/organizations.js +533 -60
  28. package/esm/coordinator/organizations.js.map +1 -1
  29. package/esm/coordinator/permissions.js +914 -107
  30. package/esm/coordinator/permissions.js.map +1 -1
  31. package/esm/coordinator/roles.js +2146 -258
  32. package/esm/coordinator/roles.js.map +1 -1
  33. package/esm/coordinator/users.js +3427 -484
  34. package/esm/coordinator/users.js.map +1 -1
  35. package/esm/events/index.js +2301 -393
  36. package/esm/events/index.js.map +1 -1
  37. package/esm/files/index.js +2053 -410
  38. package/esm/files/index.js.map +1 -1
  39. package/esm/index.js +1002 -148
  40. package/esm/index.js.map +1 -1
  41. package/esm/iot/feedTypes.js +188 -25
  42. package/esm/iot/feedTypes.js.map +1 -1
  43. package/esm/iot/feeds.js +420 -59
  44. package/esm/iot/feeds.js.map +1 -1
  45. package/esm/iot/fieldCategories.js +1172 -195
  46. package/esm/iot/fieldCategories.js.map +1 -1
  47. package/esm/iot/fieldGroupings.js +1689 -255
  48. package/esm/iot/fieldGroupings.js.map +1 -1
  49. package/esm/iot/fields.js +254 -28
  50. package/esm/iot/fields.js.map +1 -1
  51. package/esm/iot/index.js +212 -34
  52. package/esm/iot/index.js.map +1 -1
  53. package/esm/iot/outputs.js +320 -31
  54. package/esm/iot/outputs.js.map +1 -1
  55. package/esm/nionic/index.js +1097 -97
  56. package/esm/nionic/index.js.map +1 -1
  57. package/esm/request.js +1313 -219
  58. package/esm/request.js.map +1 -1
  59. package/esm/sessionTypes/auth0WebAuth.js +3395 -409
  60. package/esm/sessionTypes/auth0WebAuth.js.map +1 -1
  61. package/esm/sessionTypes/index.js +213 -22
  62. package/esm/sessionTypes/index.js.map +1 -1
  63. package/esm/sessionTypes/machineAuth.js +1314 -144
  64. package/esm/sessionTypes/machineAuth.js.map +1 -1
  65. package/esm/sessionTypes/passwordGrantAuth.js +1060 -145
  66. package/esm/sessionTypes/passwordGrantAuth.js.map +1 -1
  67. package/esm/utils/events/formatEventUpdateToServer.js +107 -4
  68. package/esm/utils/events/formatEventUpdateToServer.js.map +1 -1
  69. package/esm/utils/events/index.js +54 -2
  70. package/esm/utils/events/index.js.map +1 -1
  71. package/esm/utils/iot/formatOutputFieldDataFromServer.js +227 -14
  72. package/esm/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
  73. package/esm/utils/iot/index.js +56 -3
  74. package/esm/utils/iot/index.js.map +1 -1
  75. package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js +207 -7
  76. package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
  77. package/esm/utils/objects/createCaseChangeFn.js +449 -18
  78. package/esm/utils/objects/createCaseChangeFn.js.map +1 -1
  79. package/esm/utils/objects/index.js +56 -3
  80. package/esm/utils/objects/index.js.map +1 -1
  81. package/esm/utils/objects/map.js +520 -26
  82. package/esm/utils/objects/map.js.map +1 -1
  83. package/esm/utils/objects/toCamelCase.js +39 -3
  84. package/esm/utils/objects/toCamelCase.js.map +1 -1
  85. package/esm/utils/objects/toSnakeCase.js +39 -3
  86. package/esm/utils/objects/toSnakeCase.js.map +1 -1
  87. package/esm/utils/pagination/formatPaginatedDataFromServer.js +268 -11
  88. package/esm/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
  89. package/esm/utils/pagination/index.js +54 -2
  90. package/esm/utils/pagination/index.js.map +1 -1
  91. package/esm/utils/url/index.js +47 -2
  92. package/esm/utils/url/index.js.map +1 -1
  93. package/esm/utils/url/stringifyParams.js +176 -10
  94. package/esm/utils/url/stringifyParams.js.map +1 -1
  95. package/lib/bus/channels.js +1880 -223
  96. package/lib/bus/channels.js.map +1 -1
  97. package/lib/bus/index.browser.js +215 -43
  98. package/lib/bus/index.browser.js.map +1 -1
  99. package/lib/bus/index.js +903 -106
  100. package/lib/bus/index.js.map +1 -1
  101. package/lib/bus/webSocketConnection.browser.js +83 -15
  102. package/lib/bus/webSocketConnection.browser.js.map +1 -1
  103. package/lib/bus/webSocketConnection.js +2461 -339
  104. package/lib/bus/webSocketConnection.js.map +1 -1
  105. package/lib/config/audiences.js +33 -2
  106. package/lib/config/audiences.js.map +1 -1
  107. package/lib/config/defaults.js +33 -2
  108. package/lib/config/defaults.js.map +1 -1
  109. package/lib/config/index.js +1619 -212
  110. package/lib/config/index.js.map +1 -1
  111. package/lib/coordinator/applications.js +1016 -174
  112. package/lib/coordinator/applications.js.map +1 -1
  113. package/lib/coordinator/consent.js +600 -78
  114. package/lib/coordinator/consent.js.map +1 -1
  115. package/lib/coordinator/edgeNodes.js +517 -42
  116. package/lib/coordinator/edgeNodes.js.map +1 -1
  117. package/lib/coordinator/index.js +808 -78
  118. package/lib/coordinator/index.js.map +1 -1
  119. package/lib/coordinator/organizations.js +530 -62
  120. package/lib/coordinator/organizations.js.map +1 -1
  121. package/lib/coordinator/permissions.js +911 -109
  122. package/lib/coordinator/permissions.js.map +1 -1
  123. package/lib/coordinator/roles.js +2143 -260
  124. package/lib/coordinator/roles.js.map +1 -1
  125. package/lib/coordinator/users.js +3423 -489
  126. package/lib/coordinator/users.js.map +1 -1
  127. package/lib/events/index.js +2297 -404
  128. package/lib/events/index.js.map +1 -1
  129. package/lib/files/index.js +2050 -418
  130. package/lib/files/index.js.map +1 -1
  131. package/lib/index.js +999 -183
  132. package/lib/index.js.map +1 -1
  133. package/lib/iot/feedTypes.js +185 -27
  134. package/lib/iot/feedTypes.js.map +1 -1
  135. package/lib/iot/feeds.js +417 -61
  136. package/lib/iot/feeds.js.map +1 -1
  137. package/lib/iot/fieldCategories.js +1169 -203
  138. package/lib/iot/fieldCategories.js.map +1 -1
  139. package/lib/iot/fieldGroupings.js +1686 -263
  140. package/lib/iot/fieldGroupings.js.map +1 -1
  141. package/lib/iot/fields.js +251 -30
  142. package/lib/iot/fields.js.map +1 -1
  143. package/lib/iot/index.js +209 -55
  144. package/lib/iot/index.js.map +1 -1
  145. package/lib/iot/outputs.js +317 -34
  146. package/lib/iot/outputs.js.map +1 -1
  147. package/lib/nionic/index.js +1094 -98
  148. package/lib/nionic/index.js.map +1 -1
  149. package/lib/request.js +1310 -226
  150. package/lib/request.js.map +1 -1
  151. package/lib/sessionTypes/auth0WebAuth.js +3391 -421
  152. package/lib/sessionTypes/auth0WebAuth.js.map +1 -1
  153. package/lib/sessionTypes/index.js +209 -26
  154. package/lib/sessionTypes/index.js.map +1 -1
  155. package/lib/sessionTypes/machineAuth.js +1311 -151
  156. package/lib/sessionTypes/machineAuth.js.map +1 -1
  157. package/lib/sessionTypes/passwordGrantAuth.js +1057 -156
  158. package/lib/sessionTypes/passwordGrantAuth.js.map +1 -1
  159. package/lib/utils/events/formatEventUpdateToServer.js +102 -4
  160. package/lib/utils/events/formatEventUpdateToServer.js.map +1 -1
  161. package/lib/utils/events/index.js +51 -10
  162. package/lib/utils/events/index.js.map +1 -1
  163. package/lib/utils/iot/formatOutputFieldDataFromServer.js +224 -18
  164. package/lib/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
  165. package/lib/utils/iot/index.js +53 -15
  166. package/lib/utils/iot/index.js.map +1 -1
  167. package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js +203 -13
  168. package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
  169. package/lib/utils/objects/createCaseChangeFn.js +446 -25
  170. package/lib/utils/objects/createCaseChangeFn.js.map +1 -1
  171. package/lib/utils/objects/index.js +53 -15
  172. package/lib/utils/objects/index.js.map +1 -1
  173. package/lib/utils/objects/map.js +517 -33
  174. package/lib/utils/objects/map.js.map +1 -1
  175. package/lib/utils/objects/toCamelCase.js +36 -11
  176. package/lib/utils/objects/toCamelCase.js.map +1 -1
  177. package/lib/utils/objects/toSnakeCase.js +36 -11
  178. package/lib/utils/objects/toSnakeCase.js.map +1 -1
  179. package/lib/utils/pagination/formatPaginatedDataFromServer.js +265 -14
  180. package/lib/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
  181. package/lib/utils/pagination/index.js +51 -10
  182. package/lib/utils/pagination/index.js.map +1 -1
  183. package/lib/utils/url/index.js +44 -7
  184. package/lib/utils/url/index.js.map +1 -1
  185. package/lib/utils/url/stringifyParams.js +172 -18
  186. package/lib/utils/url/stringifyParams.js.map +1 -1
  187. package/package.json +32 -36
  188. package/src/bus/channels.js +6 -6
  189. package/src/bus/channels.spec.js +1 -1
  190. package/src/coordinator/applications.js +7 -7
  191. package/src/coordinator/applications.spec.js +1 -1
  192. package/src/coordinator/consent.js +3 -3
  193. package/src/coordinator/edgeNodes.js +3 -3
  194. package/src/coordinator/edgeNodes.spec.js +1 -1
  195. package/src/coordinator/organizations.js +4 -4
  196. package/src/coordinator/organizations.spec.js +1 -1
  197. package/src/coordinator/permissions.js +6 -6
  198. package/src/coordinator/permissions.spec.js +1 -1
  199. package/src/coordinator/roles.js +9 -9
  200. package/src/coordinator/roles.spec.js +1 -1
  201. package/src/coordinator/users.js +13 -13
  202. package/src/coordinator/users.spec.js +294 -294
  203. package/src/events/index.js +18 -18
  204. package/src/events/index.spec.js +3 -3
  205. package/src/files/index.js +9 -9
  206. package/src/files/index.spec.js +2 -2
  207. package/src/index.js +3 -1
  208. package/src/iot/feedTypes.js +2 -2
  209. package/src/iot/feeds.js +4 -4
  210. package/src/iot/feeds.spec.js +1 -1
  211. package/src/iot/fieldCategories.js +10 -10
  212. package/src/iot/fieldCategories.spec.js +2 -2
  213. package/src/iot/fieldGroupings.js +10 -10
  214. package/src/iot/fieldGroupings.spec.js +2 -2
  215. package/src/iot/fields.js +2 -2
  216. package/src/iot/fields.spec.js +1 -1
  217. package/src/iot/outputs.js +2 -2
  218. package/src/iot/outputs.spec.js +1 -1
  219. package/src/sessionTypes/auth0WebAuth.spec.js +1 -1
  220. package/src/utils/events/index.js +2 -1
  221. package/src/utils/iot/formatOutputFieldDataFromServer.js +5 -5
  222. package/src/utils/iot/formatOutputFieldDataFromServer.spec.js +2 -2
  223. package/src/utils/iot/index.js +2 -1
  224. package/src/utils/iot/parseOutputFieldNextPageUrlMetadata.js +3 -1
  225. package/src/utils/objects/index.js +2 -1
  226. package/src/utils/pagination/formatPaginatedDataFromServer.js +3 -3
  227. package/src/utils/pagination/formatPaginatedDataFromServer.spec.js +1 -1
  228. package/src/utils/pagination/index.js +2 -1
  229. package/support/mocharc.yml +1 -1
  230. package/.eslintrc +0 -24
@@ -1,47 +1,47 @@
1
1
  import axios from 'axios';
2
2
  import { expect } from 'chai';
3
3
  import omit from 'lodash.omit';
4
- import * as objectUtils from '../utils/objects';
4
+ import objectUtils from '../utils/objects';
5
5
  import Users from './users';
6
6
 
7
- describe('Coordinator/Users', function() {
7
+ describe('Coordinator/Users', function () {
8
8
  let baseRequest;
9
9
  let baseSdk;
10
10
  let expectedBaseUrl;
11
11
  let expectedTenantBaseUrl;
12
12
  let expectedLegacyBaseUrl;
13
13
 
14
- beforeEach(function() {
14
+ beforeEach(function () {
15
15
  baseRequest = {
16
16
  delete: sinon.stub().resolves(),
17
17
  get: sinon.stub().resolves(),
18
18
  post: sinon.stub().resolves(),
19
- put: sinon.stub().resolves()
19
+ put: sinon.stub().resolves(),
20
20
  };
21
21
  baseSdk = {
22
22
  config: {
23
23
  audiences: {
24
- coordinator: fixture.build('audience')
25
- }
26
- }
24
+ coordinator: fixture.build('audience'),
25
+ },
26
+ },
27
27
  };
28
28
  expectedBaseUrl = faker.internet.url();
29
29
  expectedTenantBaseUrl = faker.internet.url();
30
30
  expectedLegacyBaseUrl = faker.internet.url();
31
31
  });
32
32
 
33
- afterEach(function() {
33
+ afterEach(function () {
34
34
  sinon.restore();
35
35
  });
36
36
 
37
- describe('constructor', function() {
37
+ describe('constructor', function () {
38
38
  context(
39
39
  'when an organization ID and additional base URLs provided',
40
- function() {
40
+ function () {
41
41
  let organizationId;
42
42
  let users;
43
43
 
44
- beforeEach(function() {
44
+ beforeEach(function () {
45
45
  organizationId = fixture.build('organization').id;
46
46
 
47
47
  users = new Users(
@@ -50,77 +50,77 @@ describe('Coordinator/Users', function() {
50
50
  expectedBaseUrl,
51
51
  expectedTenantBaseUrl,
52
52
  expectedLegacyBaseUrl,
53
- organizationId
53
+ organizationId,
54
54
  );
55
55
  });
56
56
 
57
- it('sets a base url for the class instance', function() {
57
+ it('sets a base url for the class instance', function () {
58
58
  expect(users._baseUrl).to.equal(expectedBaseUrl);
59
59
  });
60
60
 
61
- it('sets a tenant base url for the class instance', function() {
61
+ it('sets a tenant base url for the class instance', function () {
62
62
  expect(users._tenantBaseUrl).to.equal(expectedTenantBaseUrl);
63
63
  });
64
64
 
65
- it('sets a legacy base url for the class instance', function() {
65
+ it('sets a legacy base url for the class instance', function () {
66
66
  expect(users._legacyBaseUrl).to.equal(expectedLegacyBaseUrl);
67
67
  });
68
68
 
69
- it('appends the supplied request module to the class instance', function() {
69
+ it('appends the supplied request module to the class instance', function () {
70
70
  expect(users._request).to.deep.equal(baseRequest);
71
71
  });
72
72
 
73
- it('appends the supplied sdk to the class instance', function() {
73
+ it('appends the supplied sdk to the class instance', function () {
74
74
  expect(users._sdk).to.deep.equal(baseSdk);
75
75
  });
76
76
 
77
- it('sets the organization ID for the class instance', function() {
77
+ it('sets the organization ID for the class instance', function () {
78
78
  expect(users._organizationId).to.equal(organizationId);
79
79
  });
80
- }
80
+ },
81
81
  );
82
82
 
83
83
  context(
84
84
  'when an organization ID and additional base URLs are not provided',
85
- function() {
85
+ function () {
86
86
  let users;
87
87
 
88
- beforeEach(function() {
88
+ beforeEach(function () {
89
89
  users = new Users(baseSdk, baseRequest, expectedLegacyBaseUrl);
90
90
  });
91
91
 
92
- it('sets a base url for the class instance', function() {
92
+ it('sets a base url for the class instance', function () {
93
93
  expect(users._baseUrl).to.equal(expectedLegacyBaseUrl);
94
94
  });
95
95
 
96
- it('sets the tenant base url for the class instance to null', function() {
96
+ it('sets the tenant base url for the class instance to null', function () {
97
97
  expect(users._tenantBaseUrl).to.equal(null);
98
98
  });
99
99
 
100
- it('sets the legacy base url for the class instance to null', function() {
100
+ it('sets the legacy base url for the class instance to null', function () {
101
101
  expect(users._legacyBaseUrl).to.equal(null);
102
102
  });
103
103
 
104
- it('appends the supplied request module to the class instance', function() {
104
+ it('appends the supplied request module to the class instance', function () {
105
105
  expect(users._request).to.deep.equal(baseRequest);
106
106
  });
107
107
 
108
- it('appends the supplied sdk to the class instance', function() {
108
+ it('appends the supplied sdk to the class instance', function () {
109
109
  expect(users._sdk).to.deep.equal(baseSdk);
110
110
  });
111
111
 
112
- it('sets the organization ID for the class instance to null', function() {
112
+ it('sets the organization ID for the class instance to null', function () {
113
113
  expect(users._organizationId).to.equal(null);
114
114
  });
115
- }
115
+ },
116
116
  );
117
117
  });
118
118
 
119
- describe('_getBaseUrl', function() {
120
- context('when additional base URLs are provided', function() {
119
+ describe('_getBaseUrl', function () {
120
+ context('when additional base URLs are provided', function () {
121
121
  let users;
122
122
 
123
- beforeEach(function() {
123
+ beforeEach(function () {
124
124
  const organizationId = fixture.build('organization').id;
125
125
 
126
126
  users = new Users(
@@ -129,46 +129,46 @@ describe('Coordinator/Users', function() {
129
129
  expectedBaseUrl,
130
130
  expectedTenantBaseUrl,
131
131
  expectedLegacyBaseUrl,
132
- organizationId
132
+ organizationId,
133
133
  );
134
134
  });
135
135
 
136
- it('returns the legacy base URL when requesting', function() {
136
+ it('returns the legacy base URL when requesting', function () {
137
137
  expect(users._getBaseUrl('legacy')).to.equal(expectedLegacyBaseUrl);
138
138
  });
139
139
 
140
- it('returns the access base URL', function() {
140
+ it('returns the access base URL', function () {
141
141
  expect(users._getBaseUrl('access')).to.equal(expectedBaseUrl);
142
142
  });
143
143
 
144
- it('returns the tenant base URL', function() {
144
+ it('returns the tenant base URL', function () {
145
145
  expect(users._getBaseUrl()).to.equal(expectedTenantBaseUrl);
146
146
  });
147
147
  });
148
148
 
149
- context('when only a legacy base URL is provided', function() {
149
+ context('when only a legacy base URL is provided', function () {
150
150
  let users;
151
151
 
152
- beforeEach(function() {
152
+ beforeEach(function () {
153
153
  users = new Users(baseSdk, baseRequest, expectedLegacyBaseUrl);
154
154
  });
155
155
 
156
- it('returns the legacy base URL', function() {
156
+ it('returns the legacy base URL', function () {
157
157
  expect(users._getBaseUrl('legacy')).to.equal(expectedLegacyBaseUrl);
158
158
  });
159
159
 
160
- it('returns the legacy base URL when requesting an access base URL', function() {
160
+ it('returns the legacy base URL when requesting an access base URL', function () {
161
161
  expect(users._getBaseUrl('access')).to.equal(expectedLegacyBaseUrl);
162
162
  });
163
163
 
164
- it('returns the legacy base URL when requesting a tenant base URL', function() {
164
+ it('returns the legacy base URL when requesting a tenant base URL', function () {
165
165
  expect(users._getBaseUrl()).to.equal(expectedLegacyBaseUrl);
166
166
  });
167
167
  });
168
168
  });
169
169
 
170
- describe('activate', function() {
171
- context('when all the required parameters are provided', function() {
170
+ describe('activate', function () {
171
+ context('when all the required parameters are provided', function () {
172
172
  let getBaseUrl;
173
173
  let user;
174
174
  let userActivationPayload;
@@ -177,24 +177,24 @@ describe('Coordinator/Users', function() {
177
177
  let request;
178
178
  let toSnakeCase;
179
179
 
180
- beforeEach(function() {
180
+ beforeEach(function () {
181
181
  user = fixture.build('contxtUser');
182
182
 
183
183
  userActivationPayload = {
184
184
  email: user.email,
185
185
  password: faker.internet.password(),
186
- userToken: faker.datatype.uuid()
186
+ userToken: faker.datatype.uuid(),
187
187
  };
188
188
 
189
189
  userActivationPayloadToServer = {
190
190
  email: userActivationPayload.email,
191
191
  password: userActivationPayload.password,
192
- user_token: userActivationPayload.userToken
192
+ user_token: userActivationPayload.userToken,
193
193
  };
194
194
 
195
195
  request = {
196
196
  ...baseRequest,
197
- post: sinon.stub().resolves()
197
+ post: sinon.stub().resolves(),
198
198
  };
199
199
 
200
200
  sinon.stub(axios, 'post').resolves();
@@ -210,68 +210,68 @@ describe('Coordinator/Users', function() {
210
210
  promise = users.activate(user.id, userActivationPayload);
211
211
  });
212
212
 
213
- it('formats the user payload', function() {
213
+ it('formats the user payload', function () {
214
214
  return promise.then(() => {
215
215
  expect(toSnakeCase).to.be.calledWith(userActivationPayload);
216
216
  });
217
217
  });
218
218
 
219
- it('gets the base URL', function() {
219
+ it('gets the base URL', function () {
220
220
  return promise.then(() => {
221
221
  expect(getBaseUrl).to.be.calledOnceWith('access');
222
222
  });
223
223
  });
224
224
 
225
- it('posts the new user to the server', function() {
225
+ it('posts the new user to the server', function () {
226
226
  expect(axios.post).to.be.calledWith(
227
227
  `${expectedBaseUrl}/users/${user.id}/activate`,
228
- userActivationPayloadToServer
228
+ userActivationPayloadToServer,
229
229
  );
230
230
  });
231
231
 
232
- it('returns a fulfilled promise', function() {
232
+ it('returns a fulfilled promise', function () {
233
233
  return expect(promise).to.be.fulfilled;
234
234
  });
235
235
  });
236
236
 
237
- context('when the organization ID is not provided', function() {
238
- it('throws an error', function() {
237
+ context('when the organization ID is not provided', function () {
238
+ it('throws an error', function () {
239
239
  const users = new Users(baseSdk, baseRequest, expectedBaseUrl);
240
240
  const promise = users.activate();
241
241
 
242
242
  return expect(promise).to.be.rejectedWith(
243
- 'A user ID is required for activating a user'
243
+ 'A user ID is required for activating a user',
244
244
  );
245
245
  });
246
246
  });
247
247
 
248
- context('when there is missing required user information', function() {
248
+ context('when there is missing required user information', function () {
249
249
  const requiredFields = ['email', 'password', 'userToken'];
250
250
 
251
251
  requiredFields.forEach((field) => {
252
- it(`it throws an error when ${field} is missing`, function() {
252
+ it(`it throws an error when ${field} is missing`, function () {
253
253
  const payload = {
254
254
  email: faker.internet.email(),
255
255
  password: faker.internet.password(),
256
- userToken: faker.datatype.uuid()
256
+ userToken: faker.datatype.uuid(),
257
257
  };
258
258
 
259
259
  const users = new Users(baseSdk, baseRequest, expectedBaseUrl);
260
260
  const promise = users.activate(
261
261
  faker.datatype.uuid(),
262
- omit(payload, [field])
262
+ omit(payload, [field]),
263
263
  );
264
264
 
265
265
  return expect(promise).to.be.rejectedWith(
266
- `A ${field} is required to activate a user.`
266
+ `A ${field} is required to activate a user.`,
267
267
  );
268
268
  });
269
269
  });
270
270
  });
271
271
  });
272
272
 
273
- describe('addApplication', function() {
274
- context('when all the required parameters are provided', function() {
273
+ describe('addApplication', function () {
274
+ context('when all the required parameters are provided', function () {
275
275
  let expectedUserApplication;
276
276
  let getBaseUrl;
277
277
  let promise;
@@ -281,7 +281,7 @@ describe('Coordinator/Users', function() {
281
281
  let userApplicationFromServer;
282
282
  let toCamelCase;
283
283
 
284
- beforeEach(function() {
284
+ beforeEach(function () {
285
285
  application = fixture.build('contxtApplication');
286
286
  user = fixture.build('contxtUser');
287
287
 
@@ -290,13 +290,13 @@ describe('Coordinator/Users', function() {
290
290
  'contxtUserApplication',
291
291
  expectedUserApplication,
292
292
  {
293
- fromServer: true
294
- }
293
+ fromServer: true,
294
+ },
295
295
  );
296
296
 
297
297
  request = {
298
298
  ...baseRequest,
299
- post: sinon.stub().resolves(userApplicationFromServer)
299
+ post: sinon.stub().resolves(userApplicationFromServer),
300
300
  };
301
301
  toCamelCase = sinon
302
302
  .stub(objectUtils, 'toCamelCase')
@@ -311,58 +311,58 @@ describe('Coordinator/Users', function() {
311
311
  promise = users.addApplication(user.id, application.id);
312
312
  });
313
313
 
314
- it('gets the base url', function() {
314
+ it('gets the base url', function () {
315
315
  expect(getBaseUrl).to.be.calledOnceWith();
316
316
  });
317
317
 
318
- it('posts the user application to the server', function() {
318
+ it('posts the user application to the server', function () {
319
319
  expect(request.post).to.be.calledWith(
320
320
  `${expectedTenantBaseUrl}/users/${user.id}/applications/${
321
321
  application.id
322
- }`
322
+ }`,
323
323
  );
324
324
  });
325
325
 
326
- it('formats the returned user application', function() {
326
+ it('formats the returned user application', function () {
327
327
  return promise.then(() => {
328
328
  expect(toCamelCase).to.be.calledWith(userApplicationFromServer);
329
329
  });
330
330
  });
331
331
 
332
- it('returns a fulfilled promise', function() {
332
+ it('returns a fulfilled promise', function () {
333
333
  return expect(promise).to.be.fulfilled;
334
334
  });
335
335
  });
336
336
 
337
- context('when the user ID is not provided', function() {
338
- it('throws an error', function() {
337
+ context('when the user ID is not provided', function () {
338
+ it('throws an error', function () {
339
339
  const application = fixture.build('contxtApplication');
340
340
 
341
341
  const users = new Users(baseSdk, baseRequest, expectedTenantBaseUrl);
342
342
  const promise = users.addApplication(null, application.id);
343
343
 
344
344
  return expect(promise).to.be.rejectedWith(
345
- 'A user ID is required for adding a application to a user'
345
+ 'A user ID is required for adding a application to a user',
346
346
  );
347
347
  });
348
348
  });
349
349
 
350
- context('when the application ID is not provided', function() {
351
- it('throws an error', function() {
350
+ context('when the application ID is not provided', function () {
351
+ it('throws an error', function () {
352
352
  const user = fixture.build('contxtUser');
353
353
 
354
354
  const users = new Users(baseSdk, baseRequest, expectedTenantBaseUrl);
355
355
  const promise = users.addApplication(user.id, null);
356
356
 
357
357
  return expect(promise).to.be.rejectedWith(
358
- 'An application ID is required for adding a application to a user'
358
+ 'An application ID is required for adding a application to a user',
359
359
  );
360
360
  });
361
361
  });
362
362
  });
363
363
 
364
- describe('addRole', function() {
365
- context('when all the required parameters are provided', function() {
364
+ describe('addRole', function () {
365
+ context('when all the required parameters are provided', function () {
366
366
  let expectedUserRole;
367
367
  let getBaseUrl;
368
368
  let promise;
@@ -372,18 +372,18 @@ describe('Coordinator/Users', function() {
372
372
  let userRoleFromServer;
373
373
  let toCamelCase;
374
374
 
375
- beforeEach(function() {
375
+ beforeEach(function () {
376
376
  role = fixture.build('contxtRole');
377
377
  user = fixture.build('contxtUser');
378
378
 
379
379
  expectedUserRole = fixture.build('contxtUserRole');
380
380
  userRoleFromServer = fixture.build('contxtUserRole', expectedUserRole, {
381
- fromServer: true
381
+ fromServer: true,
382
382
  });
383
383
 
384
384
  request = {
385
385
  ...baseRequest,
386
- post: sinon.stub().resolves(userRoleFromServer)
386
+ post: sinon.stub().resolves(userRoleFromServer),
387
387
  };
388
388
  toCamelCase = sinon
389
389
  .stub(objectUtils, 'toCamelCase')
@@ -398,58 +398,58 @@ describe('Coordinator/Users', function() {
398
398
  promise = users.addRole(user.id, role.id);
399
399
  });
400
400
 
401
- it('gets the base url', function() {
401
+ it('gets the base url', function () {
402
402
  expect(getBaseUrl).to.be.calledOnceWith();
403
403
  });
404
404
 
405
- it('posts the user role to the server', function() {
405
+ it('posts the user role to the server', function () {
406
406
  expect(request.post).to.be.calledWith(
407
- `${expectedTenantBaseUrl}/users/${user.id}/roles/${role.id}`
407
+ `${expectedTenantBaseUrl}/users/${user.id}/roles/${role.id}`,
408
408
  );
409
409
  });
410
410
 
411
- it('formats the returned user role', function() {
411
+ it('formats the returned user role', function () {
412
412
  return promise.then(() => {
413
413
  expect(toCamelCase).to.be.calledWith(userRoleFromServer);
414
414
  });
415
415
  });
416
416
 
417
- it('returns a fulfilled promise', function() {
417
+ it('returns a fulfilled promise', function () {
418
418
  return expect(promise).to.be.fulfilled;
419
419
  });
420
420
  });
421
421
 
422
- context('when the user ID is not provided', function() {
423
- it('throws an error', function() {
422
+ context('when the user ID is not provided', function () {
423
+ it('throws an error', function () {
424
424
  const role = fixture.build('contxtRole');
425
425
 
426
426
  const users = new Users(baseSdk, baseRequest, expectedTenantBaseUrl);
427
427
  const promise = users.addRole(null, role.id);
428
428
 
429
429
  return expect(promise).to.be.rejectedWith(
430
- 'A user ID is required for adding a role to a user'
430
+ 'A user ID is required for adding a role to a user',
431
431
  );
432
432
  });
433
433
  });
434
434
 
435
- context('when the role ID is not provided', function() {
436
- it('throws an error', function() {
435
+ context('when the role ID is not provided', function () {
436
+ it('throws an error', function () {
437
437
  const user = fixture.build('contxtUser');
438
438
 
439
439
  const users = new Users(baseSdk, baseRequest, expectedTenantBaseUrl);
440
440
  const promise = users.addRole(user.id, null);
441
441
 
442
442
  return expect(promise).to.be.rejectedWith(
443
- 'A role ID is required for adding a role to a user'
443
+ 'A role ID is required for adding a role to a user',
444
444
  );
445
445
  });
446
446
  });
447
447
  });
448
448
 
449
- describe('addProjectEnvironment', function() {
449
+ describe('addProjectEnvironment', function () {
450
450
  context(
451
451
  'when all the required parameters are provided and valid',
452
- function() {
452
+ function () {
453
453
  let expectedUserProjectEnvironment;
454
454
  let getBaseUrl;
455
455
  let promise;
@@ -459,24 +459,24 @@ describe('Coordinator/Users', function() {
459
459
  let userProjectEnvironmentFromServer;
460
460
  let toCamelCase;
461
461
 
462
- beforeEach(function() {
462
+ beforeEach(function () {
463
463
  projectEnvironment = fixture.build('contxtProjectEnvironment');
464
464
  user = fixture.build('contxtUser');
465
465
 
466
466
  expectedUserProjectEnvironment = fixture.build(
467
- 'contxtUserProjectEnvironment'
467
+ 'contxtUserProjectEnvironment',
468
468
  );
469
469
  userProjectEnvironmentFromServer = fixture.build(
470
470
  'contxtUserProjectEnvironment',
471
471
  expectedUserProjectEnvironment,
472
472
  {
473
- fromServer: true
474
- }
473
+ fromServer: true,
474
+ },
475
475
  );
476
476
 
477
477
  request = {
478
478
  ...baseRequest,
479
- post: sinon.stub().resolves(userProjectEnvironmentFromServer)
479
+ post: sinon.stub().resolves(userProjectEnvironmentFromServer),
480
480
  };
481
481
  toCamelCase = sinon
482
482
  .stub(objectUtils, 'toCamelCase')
@@ -491,115 +491,115 @@ describe('Coordinator/Users', function() {
491
491
  promise = users.addProjectEnvironment(
492
492
  user.id,
493
493
  projectEnvironment.id,
494
- expectedUserProjectEnvironment.accessType
494
+ expectedUserProjectEnvironment.accessType,
495
495
  );
496
496
  });
497
497
 
498
- it('gets the base url', function() {
498
+ it('gets the base url', function () {
499
499
  expect(getBaseUrl).to.be.calledOnceWith();
500
500
  });
501
501
 
502
- it('posts the user project to the server', function() {
502
+ it('posts the user project to the server', function () {
503
503
  expect(request.post).to.be.calledWith(
504
504
  `${expectedTenantBaseUrl}/users/${user.id}/project_environments/${
505
505
  projectEnvironment.id
506
506
  }`,
507
507
  {
508
- access_type: expectedUserProjectEnvironment.accessType
509
- }
508
+ access_type: expectedUserProjectEnvironment.accessType,
509
+ },
510
510
  );
511
511
  });
512
512
 
513
- it('formats the returned user project', function() {
513
+ it('formats the returned user project', function () {
514
514
  return promise.then(() => {
515
515
  expect(toCamelCase).to.be.calledWith(
516
- userProjectEnvironmentFromServer
516
+ userProjectEnvironmentFromServer,
517
517
  );
518
518
  });
519
519
  });
520
520
 
521
- it('returns a fulfilled promise', function() {
521
+ it('returns a fulfilled promise', function () {
522
522
  return expect(promise).to.be.fulfilled;
523
523
  });
524
- }
524
+ },
525
525
  );
526
526
 
527
- context('when the user ID is not provided', function() {
528
- it('throws an error', function() {
527
+ context('when the user ID is not provided', function () {
528
+ it('throws an error', function () {
529
529
  const projectEnvironment = fixture.build('contxtProjectEnvironment');
530
530
  const userProjectEnvironment = fixture.build(
531
- 'contxtUserProjectEnvironment'
531
+ 'contxtUserProjectEnvironment',
532
532
  );
533
533
 
534
534
  const users = new Users(baseSdk, baseRequest, expectedTenantBaseUrl);
535
535
  const promise = users.addProjectEnvironment(
536
536
  null,
537
537
  projectEnvironment.id,
538
- userProjectEnvironment.accessType
538
+ userProjectEnvironment.accessType,
539
539
  );
540
540
 
541
541
  return expect(promise).to.be.rejectedWith(
542
- 'A user ID is required for adding a project environment to a user'
542
+ 'A user ID is required for adding a project environment to a user',
543
543
  );
544
544
  });
545
545
  });
546
546
 
547
- context('when the project environment slug is not provided', function() {
548
- it('throws an error', function() {
547
+ context('when the project environment slug is not provided', function () {
548
+ it('throws an error', function () {
549
549
  const user = fixture.build('contxtUser');
550
550
  const userProjectEnvironment = fixture.build(
551
- 'contxtUserProjectEnvironment'
551
+ 'contxtUserProjectEnvironment',
552
552
  );
553
553
  const users = new Users(baseSdk, baseRequest, expectedTenantBaseUrl);
554
554
  const promise = users.addProjectEnvironment(
555
555
  user.id,
556
556
  null,
557
- userProjectEnvironment.accessType
557
+ userProjectEnvironment.accessType,
558
558
  );
559
559
 
560
560
  return expect(promise).to.be.rejectedWith(
561
- 'A project environment slug is required for adding a project environment to a user'
561
+ 'A project environment slug is required for adding a project environment to a user',
562
562
  );
563
563
  });
564
564
  });
565
565
 
566
- context('when the access type is not provided', function() {
567
- it('throws an error', function() {
566
+ context('when the access type is not provided', function () {
567
+ it('throws an error', function () {
568
568
  const user = fixture.build('contxtUser');
569
569
  const projectEnvironment = fixture.build('contxtProjectEnvironment');
570
570
  const users = new Users(baseSdk, baseRequest, expectedTenantBaseUrl);
571
571
  const promise = users.addProjectEnvironment(
572
572
  user.id,
573
573
  projectEnvironment.id,
574
- null
574
+ null,
575
575
  );
576
576
 
577
577
  return expect(promise).to.be.rejectedWith(
578
- 'An access type of "reader" or "admin" is required for adding a project environment to a user'
578
+ 'An access type of "reader" or "admin" is required for adding a project environment to a user',
579
579
  );
580
580
  });
581
581
  });
582
582
 
583
- context('when the access type is not a valid value', function() {
584
- it('throws an error', function() {
583
+ context('when the access type is not a valid value', function () {
584
+ it('throws an error', function () {
585
585
  const user = fixture.build('contxtUser');
586
586
  const projectEnvironment = fixture.build('contxtProjectEnvironment');
587
587
  const users = new Users(baseSdk, baseRequest, expectedTenantBaseUrl);
588
588
  const promise = users.addProjectEnvironment(
589
589
  user.id,
590
590
  projectEnvironment.id,
591
- faker.random.word()
591
+ faker.random.word(),
592
592
  );
593
593
 
594
594
  return expect(promise).to.be.rejectedWith(
595
- 'An access type of "reader" or "admin" is required for adding a project environment to a user'
595
+ 'An access type of "reader" or "admin" is required for adding a project environment to a user',
596
596
  );
597
597
  });
598
598
  });
599
599
  });
600
600
 
601
- describe('get', function() {
602
- context('the user ID is provided', function() {
601
+ describe('get', function () {
602
+ context('the user ID is provided', function () {
603
603
  let userFromServerAfterFormat;
604
604
  let userFromServerBeforeFormat;
605
605
  let expectedUserId;
@@ -608,20 +608,20 @@ describe('Coordinator/Users', function() {
608
608
  let request;
609
609
  let toCamelCase;
610
610
 
611
- beforeEach(function() {
611
+ beforeEach(function () {
612
612
  expectedUserId = faker.datatype.uuid();
613
613
  userFromServerAfterFormat = fixture.build('contxtUser', {
614
- id: expectedUserId
614
+ id: expectedUserId,
615
615
  });
616
616
  userFromServerBeforeFormat = fixture.build(
617
617
  'event',
618
618
  { id: expectedUserId },
619
- { fromServer: true }
619
+ { fromServer: true },
620
620
  );
621
621
 
622
622
  request = {
623
623
  ...baseRequest,
624
- get: sinon.stub().resolves(userFromServerBeforeFormat)
624
+ get: sinon.stub().resolves(userFromServerBeforeFormat),
625
625
  };
626
626
  toCamelCase = sinon
627
627
  .stub(objectUtils, 'toCamelCase')
@@ -634,44 +634,44 @@ describe('Coordinator/Users', function() {
634
634
  promise = users.get(expectedUserId);
635
635
  });
636
636
 
637
- it('gets the base url', function() {
637
+ it('gets the base url', function () {
638
638
  expect(getBaseUrl).to.be.calledOnceWith('access');
639
639
  });
640
640
 
641
- it('gets the user from the server', function() {
641
+ it('gets the user from the server', function () {
642
642
  expect(request.get).to.be.calledWith(
643
- `${expectedBaseUrl}/users/${expectedUserId}`
643
+ `${expectedBaseUrl}/users/${expectedUserId}`,
644
644
  );
645
645
  });
646
646
 
647
- it('formats the user object', function() {
647
+ it('formats the user object', function () {
648
648
  return promise.then(() => {
649
649
  expect(toCamelCase).to.be.calledWith(userFromServerBeforeFormat);
650
650
  });
651
651
  });
652
652
 
653
- it('returns the requested user', function() {
653
+ it('returns the requested user', function () {
654
654
  return expect(promise).to.be.fulfilled.and.to.eventually.deep.equal(
655
- userFromServerAfterFormat
655
+ userFromServerAfterFormat,
656
656
  );
657
657
  });
658
658
  });
659
659
 
660
- context('the user ID is not provided', function() {
661
- it('throws an error', function() {
660
+ context('the user ID is not provided', function () {
661
+ it('throws an error', function () {
662
662
  const users = new Users(baseSdk, baseRequest, expectedBaseUrl);
663
663
  const promise = users.get();
664
664
 
665
665
  return expect(promise).to.be.rejectedWith(
666
- 'A user ID is required for getting information about a user'
666
+ 'A user ID is required for getting information about a user',
667
667
  );
668
668
  });
669
669
  });
670
670
  });
671
671
 
672
- describe('getByOrganizationId', function() {
673
- context('legacy API', function() {
674
- context('the organization ID is provided', function() {
672
+ describe('getByOrganizationId', function () {
673
+ context('legacy API', function () {
674
+ context('the organization ID is provided', function () {
675
675
  let expectedOrganizationId;
676
676
  let expectedOrganizationUsers;
677
677
  let getBaseUrl;
@@ -680,21 +680,21 @@ describe('Coordinator/Users', function() {
680
680
  let request;
681
681
  let toCamelCase;
682
682
 
683
- beforeEach(function() {
683
+ beforeEach(function () {
684
684
  expectedOrganizationId = faker.datatype.uuid();
685
685
 
686
686
  expectedOrganizationUsers = fixture.buildList(
687
687
  'contxtUser',
688
- faker.datatype.number({ min: 1, max: 10 })
688
+ faker.datatype.number({ min: 1, max: 10 }),
689
689
  );
690
690
 
691
691
  organizationUsersFromServer = expectedOrganizationUsers.map((user) =>
692
- fixture.build('contxtUser', user, { fromServer: true })
692
+ fixture.build('contxtUser', user, { fromServer: true }),
693
693
  );
694
694
 
695
695
  request = {
696
696
  ...baseRequest,
697
- get: sinon.stub().resolves(organizationUsersFromServer)
697
+ get: sinon.stub().resolves(organizationUsersFromServer),
698
698
  };
699
699
 
700
700
  toCamelCase = sinon
@@ -710,42 +710,42 @@ describe('Coordinator/Users', function() {
710
710
  promise = users.getByOrganizationId(expectedOrganizationId);
711
711
  });
712
712
 
713
- it('gets the base url', function() {
713
+ it('gets the base url', function () {
714
714
  expect(getBaseUrl).to.be.calledOnceWith('legacy');
715
715
  });
716
716
 
717
- it('gets the user list from the server', function() {
717
+ it('gets the user list from the server', function () {
718
718
  expect(request.get).to.be.calledWith(
719
- `${expectedLegacyBaseUrl}/organizations/${expectedOrganizationId}/users`
719
+ `${expectedLegacyBaseUrl}/organizations/${expectedOrganizationId}/users`,
720
720
  );
721
721
  });
722
722
 
723
- it('formats the list of organization users', function() {
723
+ it('formats the list of organization users', function () {
724
724
  return promise.then(() => {
725
725
  expect(toCamelCase).to.be.calledWith(organizationUsersFromServer);
726
726
  });
727
727
  });
728
728
 
729
- it('returns the list of users by requested organization', function() {
729
+ it('returns the list of users by requested organization', function () {
730
730
  return expect(promise).to.be.fulfilled.and.to.eventually.deep.equal(
731
- expectedOrganizationUsers
731
+ expectedOrganizationUsers,
732
732
  );
733
733
  });
734
734
  });
735
735
 
736
- context('the organization ID is not provided', function() {
737
- it('throws an error', function() {
736
+ context('the organization ID is not provided', function () {
737
+ it('throws an error', function () {
738
738
  const users = new Users(baseSdk, baseRequest, expectedLegacyBaseUrl);
739
739
  const promise = users.getByOrganizationId();
740
740
 
741
741
  return expect(promise).to.be.rejectedWith(
742
- 'An organization ID is required for getting a list of users for an organization'
742
+ 'An organization ID is required for getting a list of users for an organization',
743
743
  );
744
744
  });
745
745
  });
746
746
  });
747
747
 
748
- context('tenant API', function() {
748
+ context('tenant API', function () {
749
749
  let expectedOrganizationId;
750
750
  let expectedOrganizationUsers;
751
751
  let getBaseUrl;
@@ -755,21 +755,21 @@ describe('Coordinator/Users', function() {
755
755
  let toCamelCase;
756
756
  let users;
757
757
 
758
- beforeEach(function() {
758
+ beforeEach(function () {
759
759
  expectedOrganizationId = faker.datatype.uuid();
760
760
 
761
761
  expectedOrganizationUsers = fixture.buildList(
762
762
  'contxtUser',
763
- faker.datatype.number({ min: 1, max: 10 })
763
+ faker.datatype.number({ min: 1, max: 10 }),
764
764
  );
765
765
 
766
766
  organizationUsersFromServer = expectedOrganizationUsers.map((user) =>
767
- fixture.build('contxtUser', user, { fromServer: true })
767
+ fixture.build('contxtUser', user, { fromServer: true }),
768
768
  );
769
769
 
770
770
  request = {
771
771
  ...baseRequest,
772
- get: sinon.stub().resolves(organizationUsersFromServer)
772
+ get: sinon.stub().resolves(organizationUsersFromServer),
773
773
  };
774
774
 
775
775
  toCamelCase = sinon
@@ -782,7 +782,7 @@ describe('Coordinator/Users', function() {
782
782
  expectedBaseUrl,
783
783
  expectedTenantBaseUrl,
784
784
  expectedLegacyBaseUrl,
785
- expectedOrganizationId
785
+ expectedOrganizationId,
786
786
  );
787
787
 
788
788
  getBaseUrl = sinon
@@ -790,39 +790,39 @@ describe('Coordinator/Users', function() {
790
790
  .returns(expectedTenantBaseUrl);
791
791
  });
792
792
 
793
- context('the organization ID is provided', function() {
794
- beforeEach(function() {
795
- promise = users.getByOrganizationId(expectedOrganizationId);
793
+ context('the organization ID is provided', function () {
794
+ beforeEach(function () {
795
+ promise = users.getByOrganizationId();
796
796
  });
797
797
 
798
- it('gets the base url', function() {
798
+ it('gets the base url', function () {
799
799
  expect(getBaseUrl).to.be.calledOnceWith();
800
800
  });
801
801
 
802
- it('gets the user list from the server', function() {
802
+ it('gets the user list from the server', function () {
803
803
  expect(request.get).to.be.calledWith(
804
- `${expectedTenantBaseUrl}/users`
804
+ `${expectedTenantBaseUrl}/users`,
805
805
  );
806
806
  });
807
807
 
808
- it('formats the list of organization users', function() {
808
+ it('formats the list of organization users', function () {
809
809
  return promise.then(() => {
810
810
  expect(toCamelCase).to.be.calledWith(organizationUsersFromServer);
811
811
  });
812
812
  });
813
813
 
814
- it('returns the list of users by requested organization', function() {
814
+ it('returns the list of users by requested organization', function () {
815
815
  return expect(promise).to.be.fulfilled.and.to.eventually.deep.equal(
816
- expectedOrganizationUsers
816
+ expectedOrganizationUsers,
817
817
  );
818
818
  });
819
819
  });
820
820
  });
821
821
  });
822
822
 
823
- describe('invite', function() {
824
- context('legacy API', function() {
825
- context('when all the required parameters are provided', function() {
823
+ describe('invite', function () {
824
+ context('legacy API', function () {
825
+ context('when all the required parameters are provided', function () {
826
826
  let organization;
827
827
  let newUserPayload;
828
828
  let newUserPayloadToServer;
@@ -834,31 +834,31 @@ describe('Coordinator/Users', function() {
834
834
  let toCamelCase;
835
835
  let toSnakeCase;
836
836
 
837
- beforeEach(function() {
837
+ beforeEach(function () {
838
838
  organization = fixture.build('contxtOrganization');
839
839
 
840
840
  expectedNewUser = fixture.build('contxtUser');
841
841
  newUserFromServer = fixture.build('contxtUser', expectedNewUser, {
842
- fromServer: true
842
+ fromServer: true,
843
843
  });
844
844
 
845
845
  newUserPayload = {
846
846
  email: expectedNewUser.email,
847
847
  firstName: expectedNewUser.firstName,
848
848
  lastName: expectedNewUser.lastName,
849
- redirectUrl: faker.internet.url()
849
+ redirectUrl: faker.internet.url(),
850
850
  };
851
851
 
852
852
  newUserPayloadToServer = {
853
853
  email: newUserPayload.email,
854
854
  first_name: newUserPayload.firstName,
855
855
  last_name: newUserPayload.lastName,
856
- redirect_url: newUserPayload.redirectUrl
856
+ redirect_url: newUserPayload.redirectUrl,
857
857
  };
858
858
 
859
859
  request = {
860
860
  ...baseRequest,
861
- post: sinon.stub().resolves(newUserFromServer)
861
+ post: sinon.stub().resolves(newUserFromServer),
862
862
  };
863
863
  toCamelCase = sinon
864
864
  .stub(objectUtils, 'toCamelCase')
@@ -877,83 +877,83 @@ describe('Coordinator/Users', function() {
877
877
  promise = users.invite(organization.id, newUserPayload);
878
878
  });
879
879
 
880
- it('formats the user payload', function() {
880
+ it('formats the user payload', function () {
881
881
  return promise.then(() => {
882
882
  expect(toSnakeCase).to.be.calledWith(newUserPayload);
883
883
  });
884
884
  });
885
885
 
886
- it('gets the base url', function() {
886
+ it('gets the base url', function () {
887
887
  expect(getBaseUrl).to.be.calledOnceWith('legacy');
888
888
  });
889
889
 
890
- it('posts the new user to the server', function() {
890
+ it('posts the new user to the server', function () {
891
891
  expect(request.post).to.be.calledWith(
892
892
  `${expectedLegacyBaseUrl}/organizations/${organization.id}/users`,
893
- newUserPayloadToServer
893
+ newUserPayloadToServer,
894
894
  );
895
895
  });
896
896
 
897
- it('formats the user response', function() {
897
+ it('formats the user response', function () {
898
898
  return promise.then(() => {
899
899
  expect(toCamelCase).to.be.calledWith(newUserFromServer);
900
900
  });
901
901
  });
902
902
 
903
- it('returns a fulfilled promise with the new user', function() {
903
+ it('returns a fulfilled promise with the new user', function () {
904
904
  return expect(promise).to.be.fulfilled.and.to.eventually.deep.equal(
905
- expectedNewUser
905
+ expectedNewUser,
906
906
  );
907
907
  });
908
908
  });
909
909
 
910
- context('when the organization ID is not provided', function() {
911
- it('throws an error', function() {
910
+ context('when the organization ID is not provided', function () {
911
+ it('throws an error', function () {
912
912
  const users = new Users(baseSdk, baseRequest, expectedLegacyBaseUrl);
913
913
  const promise = users.invite();
914
914
 
915
915
  return expect(promise).to.be.rejectedWith(
916
- 'An organization ID is required for inviting a new user'
916
+ 'An organization ID is required for inviting a new user',
917
917
  );
918
918
  });
919
919
  });
920
920
 
921
- context('when there is missing required user information', function() {
921
+ context('when there is missing required user information', function () {
922
922
  const requiredFields = [
923
923
  'email',
924
924
  'firstName',
925
925
  'lastName',
926
- 'redirectUrl'
926
+ 'redirectUrl',
927
927
  ];
928
928
 
929
929
  requiredFields.forEach((field) => {
930
- it(`it throws an error when ${field} is missing`, function() {
930
+ it(`it throws an error when ${field} is missing`, function () {
931
931
  const newUserPayload = {
932
932
  email: faker.internet.email(),
933
933
  firstName: faker.name.firstName(),
934
934
  lastName: faker.name.lastName(),
935
- redirectUrl: faker.internet.url()
935
+ redirectUrl: faker.internet.url(),
936
936
  };
937
937
 
938
938
  const users = new Users(
939
939
  baseSdk,
940
940
  baseRequest,
941
- expectedLegacyBaseUrl
941
+ expectedLegacyBaseUrl,
942
942
  );
943
943
  const promise = users.invite(
944
944
  faker.datatype.uuid(),
945
- omit(newUserPayload, [field])
945
+ omit(newUserPayload, [field]),
946
946
  );
947
947
 
948
948
  return expect(promise).to.be.rejectedWith(
949
- `A ${field} is required to create a new user.`
949
+ `A ${field} is required to create a new user.`,
950
950
  );
951
951
  });
952
952
  });
953
953
  });
954
954
  });
955
955
 
956
- context('tenant API', function() {
956
+ context('tenant API', function () {
957
957
  let organization;
958
958
  let newUserPayload;
959
959
  let newUserPayloadToServer;
@@ -966,31 +966,31 @@ describe('Coordinator/Users', function() {
966
966
  let toSnakeCase;
967
967
  let users;
968
968
 
969
- beforeEach(function() {
969
+ beforeEach(function () {
970
970
  organization = fixture.build('organization');
971
971
 
972
972
  expectedNewUser = fixture.build('contxtUser');
973
973
  newUserFromServer = fixture.build('contxtUser', expectedNewUser, {
974
- fromServer: true
974
+ fromServer: true,
975
975
  });
976
976
 
977
977
  newUserPayload = {
978
978
  email: expectedNewUser.email,
979
979
  firstName: expectedNewUser.firstName,
980
980
  lastName: expectedNewUser.lastName,
981
- redirectUrl: faker.internet.url()
981
+ redirectUrl: faker.internet.url(),
982
982
  };
983
983
 
984
984
  newUserPayloadToServer = {
985
985
  email: newUserPayload.email,
986
986
  first_name: newUserPayload.firstName,
987
987
  last_name: newUserPayload.lastName,
988
- redirect_url: newUserPayload.redirectUrl
988
+ redirect_url: newUserPayload.redirectUrl,
989
989
  };
990
990
 
991
991
  request = {
992
992
  ...baseRequest,
993
- post: sinon.stub().resolves(newUserFromServer)
993
+ post: sinon.stub().resolves(newUserFromServer),
994
994
  };
995
995
  toCamelCase = sinon
996
996
  .stub(objectUtils, 'toCamelCase')
@@ -1006,7 +1006,7 @@ describe('Coordinator/Users', function() {
1006
1006
  expectedBaseUrl,
1007
1007
  expectedTenantBaseUrl,
1008
1008
  expectedLegacyBaseUrl,
1009
- organization.id
1009
+ organization.id,
1010
1010
  );
1011
1011
 
1012
1012
  getBaseUrl = sinon
@@ -1014,57 +1014,57 @@ describe('Coordinator/Users', function() {
1014
1014
  .returns(expectedTenantBaseUrl);
1015
1015
  });
1016
1016
 
1017
- context('when all the parameters are provided', function() {
1018
- beforeEach(function() {
1017
+ context('when all the parameters are provided', function () {
1018
+ beforeEach(function () {
1019
1019
  promise = users.invite(organization.id, newUserPayload);
1020
1020
  });
1021
1021
 
1022
- it('gets the base url', function() {
1022
+ it('gets the base url', function () {
1023
1023
  expect(getBaseUrl).to.be.calledOnceWith();
1024
1024
  });
1025
1025
 
1026
- it('formats the user payload', function() {
1026
+ it('formats the user payload', function () {
1027
1027
  return promise.then(() => {
1028
1028
  expect(toSnakeCase).to.be.calledWith(newUserPayload);
1029
1029
  });
1030
1030
  });
1031
1031
 
1032
- it('posts the new user to the server', function() {
1032
+ it('posts the new user to the server', function () {
1033
1033
  expect(request.post).to.be.calledWith(
1034
1034
  `${expectedTenantBaseUrl}/users`,
1035
- newUserPayloadToServer
1035
+ newUserPayloadToServer,
1036
1036
  );
1037
1037
  });
1038
1038
 
1039
- it('formats the user response', function() {
1039
+ it('formats the user response', function () {
1040
1040
  return promise.then(() => {
1041
1041
  expect(toCamelCase).to.be.calledWith(newUserFromServer);
1042
1042
  });
1043
1043
  });
1044
1044
 
1045
- it('returns a fulfilled promise with the new user', function() {
1045
+ it('returns a fulfilled promise with the new user', function () {
1046
1046
  return expect(promise).to.be.fulfilled.and.to.eventually.deep.equal(
1047
- expectedNewUser
1047
+ expectedNewUser,
1048
1048
  );
1049
1049
  });
1050
1050
  });
1051
1051
 
1052
- context('when there is missing required user information', function() {
1052
+ context('when there is missing required user information', function () {
1053
1053
  const requiredFields = [
1054
1054
  'email',
1055
1055
  'firstName',
1056
1056
  'lastName',
1057
- 'redirectUrl'
1057
+ 'redirectUrl',
1058
1058
  ];
1059
1059
 
1060
1060
  requiredFields.forEach((field) => {
1061
- it(`it throws an error when ${field} is missing`, function() {
1061
+ it(`it throws an error when ${field} is missing`, function () {
1062
1062
  const organization = fixture.build('organization');
1063
1063
  const newUserPayload = {
1064
1064
  email: faker.internet.email(),
1065
1065
  firstName: faker.name.firstName(),
1066
1066
  lastName: faker.name.lastName(),
1067
- redirectUrl: faker.internet.url()
1067
+ redirectUrl: faker.internet.url(),
1068
1068
  };
1069
1069
 
1070
1070
  const users = new Users(
@@ -1073,15 +1073,15 @@ describe('Coordinator/Users', function() {
1073
1073
  expectedBaseUrl,
1074
1074
  expectedTenantBaseUrl,
1075
1075
  expectedLegacyBaseUrl,
1076
- organization.id
1076
+ organization.id,
1077
1077
  );
1078
1078
  const promise = users.invite(
1079
1079
  faker.datatype.uuid(),
1080
- omit(newUserPayload, [field])
1080
+ omit(newUserPayload, [field]),
1081
1081
  );
1082
1082
 
1083
1083
  return expect(promise).to.be.rejectedWith(
1084
- `A ${field} is required to create a new user.`
1084
+ `A ${field} is required to create a new user.`,
1085
1085
  );
1086
1086
  });
1087
1087
  });
@@ -1089,15 +1089,15 @@ describe('Coordinator/Users', function() {
1089
1089
  });
1090
1090
  });
1091
1091
 
1092
- describe('remove', function() {
1093
- context('legacy API', function() {
1094
- context('when all required parameters are provided', function() {
1092
+ describe('remove', function () {
1093
+ context('legacy API', function () {
1094
+ context('when all required parameters are provided', function () {
1095
1095
  let getBaseUrl;
1096
1096
  let organization;
1097
1097
  let user;
1098
1098
  let promise;
1099
1099
 
1100
- beforeEach(function() {
1100
+ beforeEach(function () {
1101
1101
  organization = fixture.build('contxtOrganization');
1102
1102
  user = fixture.build('contxtUser');
1103
1103
 
@@ -1110,54 +1110,54 @@ describe('Coordinator/Users', function() {
1110
1110
  promise = users.remove(organization.id, user.id);
1111
1111
  });
1112
1112
 
1113
- it('gets the base url', function() {
1113
+ it('gets the base url', function () {
1114
1114
  expect(getBaseUrl).to.be.calledOnceWith('legacy');
1115
1115
  });
1116
1116
 
1117
- it('sends a request to remove the user from the organization', function() {
1117
+ it('sends a request to remove the user from the organization', function () {
1118
1118
  expect(baseRequest.delete).to.be.calledWith(
1119
1119
  `${expectedLegacyBaseUrl}/organizations/${organization.id}/users/${
1120
1120
  user.id
1121
- }`
1121
+ }`,
1122
1122
  );
1123
1123
  });
1124
1124
 
1125
- it('returns a resolved promise', function() {
1125
+ it('returns a resolved promise', function () {
1126
1126
  return expect(promise).to.be.fulfilled;
1127
1127
  });
1128
1128
  });
1129
1129
 
1130
- context('when the organization ID is not provided', function() {
1131
- it('throws an error', function() {
1130
+ context('when the organization ID is not provided', function () {
1131
+ it('throws an error', function () {
1132
1132
  const users = new Users(baseSdk, baseRequest, expectedLegacyBaseUrl);
1133
1133
  const promise = users.remove(null, faker.datatype.uuid());
1134
1134
 
1135
1135
  return expect(promise).to.be.rejectedWith(
1136
- 'An organization ID is required for removing a user from an organization'
1136
+ 'An organization ID is required for removing a user from an organization',
1137
1137
  );
1138
1138
  });
1139
1139
  });
1140
1140
 
1141
- context('when the user ID is not provided', function() {
1142
- it('throws an error', function() {
1141
+ context('when the user ID is not provided', function () {
1142
+ it('throws an error', function () {
1143
1143
  const users = new Users(baseSdk, baseRequest, expectedLegacyBaseUrl);
1144
1144
  const promise = users.remove(faker.datatype.uuid(), null);
1145
1145
 
1146
1146
  return expect(promise).to.be.rejectedWith(
1147
- 'A user ID is required for removing a user from an organization'
1147
+ 'A user ID is required for removing a user from an organization',
1148
1148
  );
1149
1149
  });
1150
1150
  });
1151
1151
  });
1152
1152
 
1153
- context('tenant API', function() {
1153
+ context('tenant API', function () {
1154
1154
  let getBaseUrl;
1155
1155
  let organization;
1156
1156
  let user;
1157
1157
  let users;
1158
1158
  let promise;
1159
1159
 
1160
- beforeEach(function() {
1160
+ beforeEach(function () {
1161
1161
  organization = fixture.build('organization');
1162
1162
  user = fixture.build('contxtUser');
1163
1163
 
@@ -1167,7 +1167,7 @@ describe('Coordinator/Users', function() {
1167
1167
  expectedBaseUrl,
1168
1168
  expectedTenantBaseUrl,
1169
1169
  expectedLegacyBaseUrl,
1170
- organization.id
1170
+ organization.id,
1171
1171
  );
1172
1172
 
1173
1173
  getBaseUrl = sinon
@@ -1175,36 +1175,36 @@ describe('Coordinator/Users', function() {
1175
1175
  .returns(expectedTenantBaseUrl);
1176
1176
  });
1177
1177
 
1178
- context('when all parameters are provided', function() {
1179
- beforeEach(function() {
1178
+ context('when all parameters are provided', function () {
1179
+ beforeEach(function () {
1180
1180
  promise = users.remove(organization.id, user.id);
1181
1181
  });
1182
1182
 
1183
- it('gets the base url', function() {
1183
+ it('gets the base url', function () {
1184
1184
  expect(getBaseUrl).to.be.calledOnceWith();
1185
1185
  });
1186
1186
 
1187
- it('sends a request to remove the user from the organization', function() {
1187
+ it('sends a request to remove the user from the organization', function () {
1188
1188
  expect(baseRequest.delete).to.be.calledWith(
1189
- `${expectedTenantBaseUrl}/users/${user.id}`
1189
+ `${expectedTenantBaseUrl}/users/${user.id}`,
1190
1190
  );
1191
1191
  });
1192
1192
 
1193
- it('returns a resolved promise', function() {
1193
+ it('returns a resolved promise', function () {
1194
1194
  return expect(promise).to.be.fulfilled;
1195
1195
  });
1196
1196
  });
1197
1197
  });
1198
1198
  });
1199
1199
 
1200
- describe('removeApplication', function() {
1201
- context('when all required parameters are provided', function() {
1200
+ describe('removeApplication', function () {
1201
+ context('when all required parameters are provided', function () {
1202
1202
  let application;
1203
1203
  let getBaseUrl;
1204
1204
  let user;
1205
1205
  let promise;
1206
1206
 
1207
- beforeEach(function() {
1207
+ beforeEach(function () {
1208
1208
  application = fixture.build('contxtApplication');
1209
1209
  user = fixture.build('contxtUser');
1210
1210
 
@@ -1217,56 +1217,56 @@ describe('Coordinator/Users', function() {
1217
1217
  promise = users.removeApplication(user.id, application.id);
1218
1218
  });
1219
1219
 
1220
- it('gets the base url', function() {
1220
+ it('gets the base url', function () {
1221
1221
  expect(getBaseUrl).to.be.calledOnceWith();
1222
1222
  });
1223
1223
 
1224
- it('sends a request to removeApplication the user from the organization', function() {
1224
+ it('sends a request to removeApplication the user from the organization', function () {
1225
1225
  expect(baseRequest.delete).to.be.calledWith(
1226
1226
  `${expectedLegacyBaseUrl}/users/${user.id}/applications/${
1227
1227
  application.id
1228
- }`
1228
+ }`,
1229
1229
  );
1230
1230
  });
1231
1231
 
1232
- it('returns a resolved promise', function() {
1232
+ it('returns a resolved promise', function () {
1233
1233
  return expect(promise).to.be.fulfilled;
1234
1234
  });
1235
1235
  });
1236
1236
 
1237
- context('when the user ID is not provided', function() {
1238
- it('throws an error', function() {
1237
+ context('when the user ID is not provided', function () {
1238
+ it('throws an error', function () {
1239
1239
  const application = fixture.build('contxtApplication');
1240
1240
  const users = new Users(baseSdk, baseRequest, expectedLegacyBaseUrl);
1241
1241
  const promise = users.removeApplication(null, application.id);
1242
1242
 
1243
1243
  return expect(promise).to.be.rejectedWith(
1244
- 'A user ID is required for removing a application from a user'
1244
+ 'A user ID is required for removing a application from a user',
1245
1245
  );
1246
1246
  });
1247
1247
  });
1248
1248
 
1249
- context('when the application ID is not provided', function() {
1250
- it('throws an error', function() {
1249
+ context('when the application ID is not provided', function () {
1250
+ it('throws an error', function () {
1251
1251
  const user = fixture.build('contxtUser');
1252
1252
  const users = new Users(baseSdk, baseRequest, expectedLegacyBaseUrl);
1253
1253
  const promise = users.removeApplication(user.id, null);
1254
1254
 
1255
1255
  return expect(promise).to.be.rejectedWith(
1256
- 'An application ID is required for removing a application from a user'
1256
+ 'An application ID is required for removing a application from a user',
1257
1257
  );
1258
1258
  });
1259
1259
  });
1260
1260
  });
1261
1261
 
1262
- describe('removeRole', function() {
1263
- context('when all required parameters are provided', function() {
1262
+ describe('removeRole', function () {
1263
+ context('when all required parameters are provided', function () {
1264
1264
  let getBaseUrl;
1265
1265
  let role;
1266
1266
  let user;
1267
1267
  let promise;
1268
1268
 
1269
- beforeEach(function() {
1269
+ beforeEach(function () {
1270
1270
  role = fixture.build('contxtRole');
1271
1271
  user = fixture.build('contxtUser');
1272
1272
 
@@ -1279,54 +1279,54 @@ describe('Coordinator/Users', function() {
1279
1279
  promise = users.removeRole(user.id, role.id);
1280
1280
  });
1281
1281
 
1282
- it('gets the base url', function() {
1282
+ it('gets the base url', function () {
1283
1283
  expect(getBaseUrl).to.be.calledOnceWith();
1284
1284
  });
1285
1285
 
1286
- it('sends a request to removeRole the user from the organization', function() {
1286
+ it('sends a request to removeRole the user from the organization', function () {
1287
1287
  expect(baseRequest.delete).to.be.calledWith(
1288
- `${expectedTenantBaseUrl}/users/${user.id}/roles/${role.id}`
1288
+ `${expectedTenantBaseUrl}/users/${user.id}/roles/${role.id}`,
1289
1289
  );
1290
1290
  });
1291
1291
 
1292
- it('returns a resolved promise', function() {
1292
+ it('returns a resolved promise', function () {
1293
1293
  return expect(promise).to.be.fulfilled;
1294
1294
  });
1295
1295
  });
1296
1296
 
1297
- context('when the user ID is not provided', function() {
1298
- it('throws an error', function() {
1297
+ context('when the user ID is not provided', function () {
1298
+ it('throws an error', function () {
1299
1299
  const role = fixture.build('contxtRole');
1300
1300
  const users = new Users(baseSdk, baseRequest, expectedTenantBaseUrl);
1301
1301
  const promise = users.removeRole(null, role.id);
1302
1302
 
1303
1303
  return expect(promise).to.be.rejectedWith(
1304
- 'A user ID is required for removing a role from a user'
1304
+ 'A user ID is required for removing a role from a user',
1305
1305
  );
1306
1306
  });
1307
1307
  });
1308
1308
 
1309
- context('when the role ID is not provided', function() {
1310
- it('throws an error', function() {
1309
+ context('when the role ID is not provided', function () {
1310
+ it('throws an error', function () {
1311
1311
  const user = fixture.build('contxtUser');
1312
1312
  const users = new Users(baseSdk, baseRequest, expectedTenantBaseUrl);
1313
1313
  const promise = users.removeRole(user.id, null);
1314
1314
 
1315
1315
  return expect(promise).to.be.rejectedWith(
1316
- 'A role ID is required for removing a role from a user'
1316
+ 'A role ID is required for removing a role from a user',
1317
1317
  );
1318
1318
  });
1319
1319
  });
1320
1320
  });
1321
1321
 
1322
- describe('removeProjectEnvironment', function() {
1323
- context('when all required parameters are provided', function() {
1322
+ describe('removeProjectEnvironment', function () {
1323
+ context('when all required parameters are provided', function () {
1324
1324
  let getBaseUrl;
1325
1325
  let projectEnvironment;
1326
1326
  let user;
1327
1327
  let promise;
1328
1328
 
1329
- beforeEach(function() {
1329
+ beforeEach(function () {
1330
1330
  projectEnvironment = fixture.build('contxtProjectEnvironment');
1331
1331
  user = fixture.build('contxtUser');
1332
1332
 
@@ -1338,62 +1338,62 @@ describe('Coordinator/Users', function() {
1338
1338
 
1339
1339
  promise = users.removeProjectEnvironment(
1340
1340
  user.id,
1341
- projectEnvironment.id
1341
+ projectEnvironment.id,
1342
1342
  );
1343
1343
  });
1344
1344
 
1345
- it('gets the base url', function() {
1345
+ it('gets the base url', function () {
1346
1346
  expect(getBaseUrl).to.be.calledOnceWith();
1347
1347
  });
1348
1348
 
1349
- it('sends a request to removeProjectEnvironment the user from the organization', function() {
1349
+ it('sends a request to removeProjectEnvironment the user from the organization', function () {
1350
1350
  expect(baseRequest.delete).to.be.calledWith(
1351
1351
  `${expectedTenantBaseUrl}/users/${user.id}/project_environments/${
1352
1352
  projectEnvironment.id
1353
- }`
1353
+ }`,
1354
1354
  );
1355
1355
  });
1356
1356
 
1357
- it('returns a resolved promise', function() {
1357
+ it('returns a resolved promise', function () {
1358
1358
  return expect(promise).to.be.fulfilled;
1359
1359
  });
1360
1360
  });
1361
1361
 
1362
- context('when the user ID is not provided', function() {
1363
- it('throws an error', function() {
1362
+ context('when the user ID is not provided', function () {
1363
+ it('throws an error', function () {
1364
1364
  const projectEnvironment = fixture.build('contxtProjectEnvironment');
1365
1365
  const users = new Users(baseSdk, baseRequest, expectedTenantBaseUrl);
1366
1366
  const promise = users.removeProjectEnvironment(
1367
1367
  null,
1368
- projectEnvironment.id
1368
+ projectEnvironment.id,
1369
1369
  );
1370
1370
 
1371
1371
  return expect(promise).to.be.rejectedWith(
1372
- 'A user ID is required for removing a project environment from a user'
1372
+ 'A user ID is required for removing a project environment from a user',
1373
1373
  );
1374
1374
  });
1375
1375
  });
1376
1376
 
1377
- context('when the project environment slug is not provided', function() {
1378
- it('throws an error', function() {
1377
+ context('when the project environment slug is not provided', function () {
1378
+ it('throws an error', function () {
1379
1379
  const user = fixture.build('contxtUser');
1380
1380
  const users = new Users(baseSdk, baseRequest, expectedTenantBaseUrl);
1381
1381
  const promise = users.removeProjectEnvironment(user.id, null);
1382
1382
 
1383
1383
  return expect(promise).to.be.rejectedWith(
1384
- 'A project environment slug is required for removing a project environment from a user'
1384
+ 'A project environment slug is required for removing a project environment from a user',
1385
1385
  );
1386
1386
  });
1387
1387
  });
1388
1388
  });
1389
1389
 
1390
- describe('sync', function() {
1391
- context('when all required parameters are present', function() {
1390
+ describe('sync', function () {
1391
+ context('when all required parameters are present', function () {
1392
1392
  let getBaseUrl;
1393
1393
  let user;
1394
1394
  let promise;
1395
1395
 
1396
- beforeEach(function() {
1396
+ beforeEach(function () {
1397
1397
  user = fixture.build('contxtUser');
1398
1398
 
1399
1399
  const users = new Users(baseSdk, baseRequest, expectedBaseUrl);
@@ -1403,28 +1403,28 @@ describe('Coordinator/Users', function() {
1403
1403
  promise = users.sync(user.id);
1404
1404
  });
1405
1405
 
1406
- it('gets the base url', function() {
1406
+ it('gets the base url', function () {
1407
1407
  expect(getBaseUrl).to.be.calledOnceWith('access');
1408
1408
  });
1409
1409
 
1410
- it('sends a request to sync user permissions', function() {
1410
+ it('sends a request to sync user permissions', function () {
1411
1411
  expect(baseRequest.get).to.be.calledWith(
1412
- `${expectedBaseUrl}/users/${user.id}/sync`
1412
+ `${expectedBaseUrl}/users/${user.id}/sync`,
1413
1413
  );
1414
1414
  });
1415
1415
 
1416
- it('returns a resolved promise', function() {
1416
+ it('returns a resolved promise', function () {
1417
1417
  return expect(promise).to.be.fulfilled;
1418
1418
  });
1419
1419
  });
1420
1420
 
1421
- context('when the user ID is not provided', function() {
1422
- it('throws an error', function() {
1421
+ context('when the user ID is not provided', function () {
1422
+ it('throws an error', function () {
1423
1423
  const users = new Users(baseSdk, baseRequest, expectedBaseUrl);
1424
1424
  const promise = users.sync(null);
1425
1425
 
1426
1426
  return expect(promise).to.be.rejectedWith(
1427
- 'A user ID is required for syncing user permissions'
1427
+ 'A user ID is required for syncing user permissions',
1428
1428
  );
1429
1429
  });
1430
1430
  });