@getjones/test-infra 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,264 @@
1
- # Extazy - Extremely Fast Test Setup & Preparation
1
+ # Package Name: @getjones/test-infra
2
2
 
3
3
  ## Package Goal
4
+
4
5
  * Providing an easy and reusable interface for the backend system. Means, both by the OpenAPI, and the internal API.
5
6
 
6
- ## Configuration
7
+ ## Interface
8
+
9
+ ### init
10
+
11
+ * require the package with settled up configuration json
12
+
13
+ ```node
14
+ const { internalAPI } = require('@getjones/test-infra')(conf);
15
+ ```
16
+
17
+ * configuration example
18
+
19
+ ```node
20
+ const dotenv = require('dotenv');
21
+
22
+ dotenv.config();
23
+
24
+ module.exports = {
25
+ backendUrl: process.env.BACKEND_URL,
26
+ credentials: {
27
+ superUser: process.env.CREDENTIALS_SUPER_USER,
28
+ superUserPassword: process.env.CREDENTIALS_SUPER_USER_PASSWORD,
29
+ strongPassword: process.env.CREDENTIALS_STRONG_PASSWORD,
30
+ },
31
+ accountCreationSecret: process.env.ACCOUNT_CREATION_SECRET,
32
+ environment: process.env.ENVIRONMENT,
33
+ email: process.env.EMAIL,
34
+ };
35
+ ```
36
+
37
+ ### internalAPI
38
+
39
+ * internalAPI contains the next services:
40
+ * auth
41
+ * accounts
42
+ * accountSettings
43
+ * projects
44
+
45
+ ```node
46
+ const { auth, accounts, accountSettings, projects } = internalAPI;
47
+ ```
48
+
49
+ ### auth
50
+
51
+ ```node
52
+
53
+ /**
54
+ *
55
+ * @param email (string)
56
+ * @param password (string)
57
+ * @return Auth cookie (string) with given email privileges.
58
+ */
59
+ const getAuthCookie = async (email, password) => {
60
+ };
61
+
62
+ /**
63
+ *
64
+ * Required Configuration: {
65
+ * credentials.superUser,
66
+ * credentials.superUserPassword
67
+ * }
68
+ * @return ICS cookie (String)
69
+ */
70
+ const getIcsCookie = async () => {
71
+ };
72
+ ```
73
+
74
+ ### accounts
75
+
76
+ ```node
77
+
78
+ /**
79
+ *
80
+ * Required Configuration: {
81
+ * accountCreationSecret: accountCreationSecret,
82
+ * }
83
+ *
84
+ * If you want to use default password so
85
+ * 'credentials.strongPassword' is needed
86
+ * to be a part of the configuration.
87
+ *
88
+ * @param email (string)
89
+ * @param accountName (string)
90
+ * @param context (string): Should contain ICS cookie
91
+ * @return Account (object)
92
+ */
93
+
94
+ const createAccount = async (email, accountName, context,
95
+ password = credentials.strongPassword,
96
+ propertyType = PROPERTY_TYPE) => {
97
+ };
98
+
99
+ /**
100
+ *
101
+ * @param accountName (string)
102
+ * @param context (string): Should contains ICS cookie
103
+ * @return Account (object)
104
+ */
105
+ const getAccount = async (accountName, context) => {
106
+ };
107
+
108
+ /**
109
+ *
110
+ * @param email (string)
111
+ * @param accountName (string)
112
+ * @param context (string): Should contain ICS cookie
113
+ * @param password (string)
114
+ * @return Account (object)
115
+ */
116
+ const getOrCreateAccount = async (email, accountName, context, password = credentials.strongPassword) => {
117
+ };
118
+
119
+ /**
120
+ *
121
+ * @param accountName (string)
122
+ * @param context (string): Should contain ICS cookie
123
+ * @return Account ID (String)
124
+ */
125
+ const getAccountId = async (accountName, context) => {
126
+ };
127
+
128
+ /**
129
+ *
130
+ * @param accountName (string)
131
+ * @param context (string): Should contains ICS cookie
132
+ * @return Http Response
133
+ */
134
+ const deleteAccountByName = async (accountName, context) => {
135
+ };
136
+
137
+ /**
138
+ *
139
+ * @param accountId (string)
140
+ * @param context (string): Should contain ICS cookie
141
+ * @return Http Response
142
+ */
143
+ const deleteAccountById = async (accountId, context) => {
144
+ };
145
+ ```
146
+
147
+ ### accountSettings
148
+
149
+ ```node
150
+
151
+ /**
152
+ *
153
+ * @param accountId (string)
154
+ * @param context (string): Should contain ICS cookie
155
+ * @return Account Settings (object)
156
+ */
157
+ const getAccountSettings = async (accountId, context) => {
158
+ };
159
+
160
+ /**
161
+ *
162
+ * @param accountId (string)
163
+ * @param AccountSettings (object) Should Contain:
164
+ * isMultiPropertyTenants (boolean)
165
+ * isHighPriority (boolean)
166
+ * @param context (string): Should contain ICS cookie
167
+ * @return Http Response
168
+ */
169
+ const updateAccountSettings = async (accountId, isMultiPropertyTenants, isHighPriority, context) => {
170
+ };
171
+
172
+ /**
173
+ * Summary: Change account settings to default
174
+ * Description:
175
+ * Update The Next Account Settings:
176
+ * isMultiPropertyTenants: false
177
+ * isHighPriority: false
178
+ * @param accountId (string)
179
+ * @param context (string): Should Contain ICS cookie
180
+ * @return Http Response
181
+ */
182
+ const restoreAccountSettings = async (accountId, context) => {
183
+ };
184
+
185
+ ```
186
+
187
+ ### projects
188
+
189
+ ```node
190
+
191
+ /**
192
+ *
193
+ * @param accountName (string)
194
+ * @param context (string): Should contain cookie
195
+ * User's cookie that is related to this account or ICS cookie
196
+ * @return List of projects ([objects])
197
+ */
198
+ const getProjectsByAccountName = async (accountName, context) => {
199
+ };
200
+
201
+ /**
202
+ *
203
+ * @param accountId (String)
204
+ * @param context (string): Should contain cookie
205
+ * User's cookie that is related to this account or ICS cookie
206
+ * @return List of projects ([objects])
207
+ */
208
+ const getProjectsByAccountId = async (accountId, context) => {
209
+ };
210
+
211
+ /**
212
+ *
213
+ * @param accountId (string)
214
+ * @param projectName (string)
215
+ * @param context (string): Should contain cookie
216
+ * User's cookie that is related to this account or ICS cookie
217
+ * @return List of projects ([objects])
218
+ */
219
+ const getProjectsByName = async (accountId, projectName, context) => {
220
+ };
221
+
222
+ /**
223
+ * Summary: Delete project by given details
224
+ * @param accountId (string)
225
+ * @param projectName (string)
226
+ * @param context (string): Should contain cookie
227
+ * User's cookie that is related to this account or ICS cookie
228
+ * @return List of projects ([objects])
229
+ */
230
+ const deleteProjectByName = async (accountId, projectName, context) => {
231
+ };
232
+
233
+ /**
234
+ *
235
+ * @param project (object)
236
+ * @param accountName (string)
237
+ * @param context (string): Should contain cookie
238
+ * User's cookie that is related to this account or ICS cookie
239
+ * @return object contains generated projectId
240
+ */
7
241
 
242
+ // Example for project input (Not all of them are required):
243
+ const createProjectInput = {
244
+ 'projectName': project.name,
245
+ 'userId': '',
246
+ 'projectDescription': project.description,
247
+ 'address': project.address,
248
+ 'projectNumber': project.number,
249
+ 'projectStartDate': project.startDate,
250
+ 'projectEndDate': project.endDate,
251
+ 'city': project.city,
252
+ 'state': project.state,
253
+ 'zipCode': project.zipCode,
254
+ 'companyNameForProject': project.companyNameForProject,
255
+ 'certificateHolder': '',
256
+ 'additionalInsured': '',
257
+ 'tenantSolutionEnabled': '',
258
+ 'onboardingEnabled': '',
259
+ 'automaticRenewalEnabled': ''
260
+ };
8
261
 
9
- * JSON object that includes configuration for api calls
10
- * Usage Example:https://bitbucket.org/mirudman/integration-tests/src/master/tests/src/emailEditor/draft.test.js
262
+ const createProject = async (project, accountName, context) => {
263
+ };
264
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getjones/test-infra",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Providing internal and openapi interface",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const env = require('./env');
2
2
 
3
- const extazy = conf => {
3
+ const init = conf => {
4
4
  env.init(conf);
5
5
 
6
6
  const auth = require('./internal-api/auth/auth.setup');
@@ -13,4 +13,4 @@ const extazy = conf => {
13
13
  return { internalAPI };
14
14
  };
15
15
 
16
- module.exports = extazy;
16
+ module.exports = init;
@@ -68,25 +68,12 @@ const deleteAccountById = async (accountId, context) => {
68
68
  return accountsAPI.deleteAccount(accountId, context);
69
69
  };
70
70
 
71
- const updateAccountSettings = async (accountId, isMultiPropertyTenants, isHighPriority, context) => {
72
- return accountsAPI.updateAccountSettings(accountId, { isMultiPropertyTenants, isHighPriority }, context);
73
- };
74
-
75
- const restoreAccountSettings = async (accountId, context) => {
76
- return accountsAPI.updateAccountSettings(accountId, {
77
- isMultiPropertyTenants: false,
78
- isHighPriority: false
79
- }, context);
80
- };
81
-
82
71
  module.exports = {
83
72
  getAccount,
84
73
  getOrCreateAccount,
85
74
  getAccountId,
86
75
  createAccount,
87
76
  deleteAccountByName,
88
- deleteAccountById,
89
- updateAccountSettings,
90
- restoreAccountSettings
77
+ deleteAccountById
91
78
  };
92
79
 
@@ -12,7 +12,7 @@ const getProjectsByAccountId = async (accountId, context) => {
12
12
 
13
13
  const getProjectsByName = async (accountId, projectName, context) => {
14
14
  const projects = await getProjectsByAccountId(accountId, context);
15
- const filteredProjects = projects.filter(project => project.projectName === projectName);
15
+ const filteredProjects = projects.filter(project => project.projectName === projectName) || [];
16
16
  return filteredProjects;
17
17
  };
18
18