@getjones/test-infra 4.5.24 → 4.5.26

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.
@@ -0,0 +1,156 @@
1
+ import _import from 'eslint-plugin-import';
2
+ import { fixupPluginRules } from '@eslint/compat';
3
+ import globals from 'globals';
4
+ import babelParser from '@babel/eslint-parser';
5
+ import path from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ import js from '@eslint/js';
8
+ import { FlatCompat } from '@eslint/eslintrc';
9
+ import stylisticJs from '@stylistic/eslint-plugin-js'
10
+
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+ const compat = new FlatCompat({
14
+ baseDirectory: __dirname,
15
+ recommendedConfig: js.configs.recommended,
16
+ allConfig: js.configs.all
17
+ });
18
+
19
+ export default [...compat.extends(), {
20
+ plugins: {
21
+ import: fixupPluginRules(_import),
22
+ '@stylistic/js': stylisticJs,
23
+ },
24
+ files: ['**/*.js'],
25
+ languageOptions: {
26
+ globals: {
27
+ ...globals.node,
28
+ ...globals.mocha
29
+ },
30
+
31
+ parser: babelParser,
32
+ ecmaVersion: 2020,
33
+ sourceType: 'module',
34
+
35
+ parserOptions: {
36
+ ecmaFeatures: {
37
+ jsx: false,
38
+ spread: true
39
+ },
40
+
41
+ impliedStrict: true,
42
+ requireConfigFile: false,
43
+
44
+ babelOptions: {
45
+ presets: ['@babel/preset-env']
46
+ }
47
+ }
48
+ },
49
+
50
+ rules: {
51
+ strict: ['error', 'global'],
52
+ semi: ['error', 'always'],
53
+ quotes: ['error', 'single'],
54
+ 'prefer-template': 1,
55
+ 'no-unused-vars': 1,
56
+ 'no-cond-assign': 'error',
57
+ 'no-dupe-args': 'error',
58
+ 'no-dupe-keys': 'error',
59
+ 'no-empty': 'error',
60
+ 'arrow-parens': ['error', 'as-needed'],
61
+ 'no-multi-spaces': 'error',
62
+ 'rest-spread-spacing': ['error', 'always'],
63
+
64
+ 'prefer-const': ['error', {
65
+ destructuring: 'all'
66
+ }],
67
+
68
+ 'no-const-assign': 'error',
69
+ 'no-trailing-spaces': 'error',
70
+
71
+ 'no-multiple-empty-lines': ['error', {
72
+ max: 1,
73
+ maxBOF: 0,
74
+ maxEOF: 0
75
+ }],
76
+
77
+ 'object-curly-spacing': ['error', 'always'],
78
+ 'brace-style': 'error',
79
+ curly: 'error',
80
+
81
+ "space-before-function-paren": ["error", {
82
+ "anonymous": "never",
83
+ "named": "never",
84
+ "asyncArrow": "always"
85
+ }],
86
+
87
+ 'lines-between-class-members': ['error', 'always'],
88
+
89
+ 'padding-line-between-statements': ['error', {
90
+ blankLine: 'always',
91
+ prev: 'import',
92
+ next: '*'
93
+ }, {
94
+ blankLine: 'any',
95
+ prev: 'import',
96
+ next: 'import'
97
+ }, {
98
+ blankLine: 'always',
99
+ prev: '*',
100
+ next: 'if'
101
+ }, {
102
+ blankLine: 'always',
103
+ prev: 'if',
104
+ next: '*'
105
+ }, {
106
+ blankLine: 'always',
107
+ prev: ['function'],
108
+ next: 'function'
109
+ }],
110
+
111
+ 'object-property-newline': ['error', {
112
+ allowAllPropertiesOnSameLine: true
113
+ }],
114
+
115
+ 'comma-dangle': ['error', 'never'],
116
+
117
+ 'comma-spacing': ['error', {
118
+ before: false,
119
+ after: true
120
+ }],
121
+
122
+ 'array-bracket-spacing': ['error', 'never'],
123
+ 'space-in-parens': ['error', 'never'],
124
+
125
+ 'key-spacing': ['error', {
126
+ beforeColon: false,
127
+ afterColon: true,
128
+ mode: 'strict'
129
+ }],
130
+
131
+ 'padded-blocks': ['error', 'never'],
132
+
133
+ indent: ['error', 'tab', {
134
+ SwitchCase: 1
135
+ }],
136
+
137
+ 'no-mixed-spaces-and-tabs': 'error',
138
+ 'arrow-spacing': 'error',
139
+ 'eol-last': ['error', 'always'],
140
+ 'space-infix-ops': 'error',
141
+ 'space-before-blocks': 'error',
142
+
143
+ 'keyword-spacing': ['error', {
144
+ before: true,
145
+ after: true
146
+ }],
147
+
148
+ 'func-call-spacing': ['error', 'never'],
149
+ 'no-whitespace-before-property': 'error',
150
+
151
+ 'function-call-argument-newline': ['error', 'consistent'],
152
+ 'dot-location': ['error', 'object'],
153
+ 'semi-style': ['error', 'last'],
154
+ 'no-unexpected-multiline': 'error'
155
+ }
156
+ }];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getjones/test-infra",
3
- "version": "4.5.24",
3
+ "version": "4.5.26",
4
4
  "description": "Providing internal and openapi interface",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -11,8 +11,8 @@ const Endpoints = {
11
11
  getRecordHistoryOverrideEventGapData: recordHistoryId => `${backendUrl}/saas/record/gap/history/${recordHistoryId}/report`,
12
12
  getRecordOcrStatus: contractorId => `${backendUrl}/saas/contractor/${contractorId}/ocr/status`,
13
13
  delete: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
14
- archive: contractorId => `${backendUrl}/saas/contractor/${contractorId}/archive`,
15
- restore: contractorId => `${backendUrl}/saas/contractor/${contractorId}/restore`,
14
+ archive: `${backendUrl}/saas/contractor/archive`,
15
+ restore: `${backendUrl}/saas/contractor/restore`,
16
16
  edit: contractorId => `${backendUrl}/saas/contractors/${contractorId}/update`,
17
17
  sendGaps: requestId => `${backendUrl}/saas/request/${requestId}/compliance/status`,
18
18
  resendInvitation: requestId => `${backendUrl}/saas/contractor/${requestId}/reminders/reset`,
@@ -71,11 +71,11 @@ const deleteByContractorId = (contractorId, context) => {
71
71
  };
72
72
 
73
73
  const archiveRecord = (recordVerificationModel, context) => {
74
- return requests.deleteRequestHandler(Endpoints.archive(recordVerificationModel.contractorId), context, {}, {}, recordVerificationModel);
74
+ return requests.deleteRequestHandler(Endpoints.archive, context, {}, {}, recordVerificationModel);
75
75
  };
76
76
 
77
77
  const restoreRecord = (recordVerificationModel, context) => {
78
- return requests.postRequestHandler(Endpoints.restore(recordVerificationModel.contractorId), recordVerificationModel, context);
78
+ return requests.postRequestHandler(Endpoints.restore, recordVerificationModel, context);
79
79
  };
80
80
 
81
81
  const editContractor = (editRequestModel, context) => {
@@ -182,8 +182,14 @@ const getSubscriptionModel = (data, { recaptchaResponse = 'recaptchaResponse' }
182
182
  return new SubscriptionModel(data, recaptchaResponse);
183
183
  };
184
184
 
185
- const deleteByContractorId = (contractorId, context) => {
186
- return contractorsAPI.deleteByContractorId(contractorId, context);
185
+ const deleteByContractorId = async (contractorId, context, { expectError } = {}) => {
186
+ const response = await contractorsAPI.deleteByContractorId(contractorId, context);
187
+
188
+ if (response.status !== httpResponseStatusCodes.NO_CONTENT && !expectError) {
189
+ throw new Error(`Failed to delete record: ${response.statusText}`);
190
+ }
191
+
192
+ return response;
187
193
  };
188
194
 
189
195
  const deleteAllRecordsInAccount = async (accountId, context, { activationStatus = [activationStatuses.ACTIVE, activationStatuses.ARCHIVED, activationStatuses.DRAFT] } = {}) => {
@@ -1,4 +1,5 @@
1
1
  const projectsApi = require('./projects.api');
2
+ const httpResponseStatusCodes = require('../../../common/httpResponseStatusCodes.json');
2
3
 
3
4
  const getProjectsByName = async (apiKey, name) => {
4
5
  return projectsApi.getProjectsByName(apiKey, { name });
@@ -33,7 +34,13 @@ const getProjectServiceArea = async (apiKey, city, state) => {
33
34
  };
34
35
 
35
36
  const archiveProject = async (apiKey, projectId) => {
36
- return projectsApi.archiveProject(apiKey, projectId);
37
+ const response = await projectsApi.archiveProject(apiKey, projectId);
38
+
39
+ if (response.status !== httpResponseStatusCodes.OK) {
40
+ throw new Error(`Failed to archive project: ${projectId}`);
41
+ }
42
+
43
+ return response;
37
44
  };
38
45
 
39
46
  const restoreProject = async (apiKey, projectId) => {