@superblocksteam/sabs-client 0.419.0 → 0.423.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/sabs-client",
3
- "version": "v0.419.0",
3
+ "version": "v0.423.0",
4
4
  "description": "Superblocks Application Build System Client for TypeScript",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,11 +8,16 @@
8
8
  },
9
9
  "main": "dist/index.js",
10
10
  "types": "dist/index.d.ts",
11
+ "files": [
12
+ "dist",
13
+ "package.json",
14
+ "README.md"
15
+ ],
11
16
  "license": "Superblocks Community Software License",
12
17
  "dependencies": {
13
18
  "@superblocksteam/shared": "0.9543.7",
14
19
  "axios": "^1.8.3",
15
- "@superblocksteam/sabs-types": "v0.419.0"
20
+ "@superblocksteam/sabs-types": "v0.423.0"
16
21
  },
17
22
  "devDependencies": {
18
23
  "@babel/preset-typescript": "^7.26.0",
@@ -44,7 +49,7 @@
44
49
  "node": ">=20.19.x"
45
50
  },
46
51
  "scripts": {
47
- "build": "pnpm install && pnpm run lint:fix && tsc",
52
+ "build": "pnpm install && pnpm run lint:fix && pnpm exec tsc",
48
53
  "clean": "npx rimraf ./dist ./coverage *tsbuildinfo",
49
54
  "lint": "eslint . --ext ts --max-warnings 0 --cache --cache-strategy content --cache-location ~/.cache/eslint/",
50
55
  "lint:fix": "eslint . --ext ts --fix --cache --cache-strategy content --cache-location ~/.cache/eslint/",
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- 20
package/.prettierignore DELETED
@@ -1,3 +0,0 @@
1
- ./build
2
- ./node_modules
3
- .github
package/.prettierrc DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "semi": true,
3
- "trailingComma": "none",
4
- "singleQuote": true,
5
- "tabWidth": 2,
6
- "printWidth": 140,
7
- "arrowParens": "always"
8
- }
package/eslint.config.mjs DELETED
@@ -1,261 +0,0 @@
1
- import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
2
- import { FlatCompat } from '@eslint/eslintrc';
3
- import js from '@eslint/js';
4
- import typescriptEslint from '@typescript-eslint/eslint-plugin';
5
- import tsParser from '@typescript-eslint/parser';
6
- import _import from 'eslint-plugin-import';
7
- import prettier from 'eslint-plugin-prettier';
8
- import globals from 'globals';
9
- import path from 'node:path';
10
- import { fileURLToPath } from 'node:url';
11
-
12
- const __filename = fileURLToPath(import.meta.url);
13
- const __dirname = path.dirname(__filename);
14
- const compat = new FlatCompat({
15
- baseDirectory: __dirname,
16
- recommendedConfig: js.configs.recommended,
17
- allConfig: js.configs.all
18
- });
19
-
20
- export default [
21
- {
22
- // Ignore Jest configuration file (it's excluded from tsconfig.json, so it's problematic!)
23
- ignores: [
24
- 'coverage/*',
25
- 'dist/*',
26
- 'eslint.config.mjs',
27
- '**/jest.config.js'
28
- ]
29
- },
30
- ...fixupConfigRules(
31
- compat.extends(
32
- 'eslint:recommended',
33
- 'plugin:@typescript-eslint/eslint-recommended',
34
- 'plugin:@typescript-eslint/recommended',
35
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
36
- 'plugin:import/typescript',
37
- 'prettier',
38
- 'plugin:prettier/recommended'
39
- )
40
- ),
41
- {
42
- plugins: {
43
- '@typescript-eslint': fixupPluginRules(typescriptEslint),
44
- import: fixupPluginRules(_import),
45
- prettier: fixupPluginRules(prettier)
46
- },
47
-
48
- languageOptions: {
49
- globals: {
50
- ...globals.jest,
51
- ...globals.node
52
- },
53
-
54
- parser: tsParser,
55
- ecmaVersion: 2020,
56
- sourceType: 'commonjs',
57
-
58
- parserOptions: {
59
- impliedStrict: true,
60
- project: './**/tsconfig.json'
61
- }
62
- },
63
-
64
- settings: {
65
- 'import/parsers': {
66
- '@typescript-eslint/parser': ['.ts', '.tsx']
67
- },
68
-
69
- 'import/resolver': {
70
- node: {},
71
-
72
- typescript: {
73
- project: './**/tsconfig.json'
74
- }
75
- }
76
- },
77
-
78
- // Custom Configurations
79
- rules: {
80
- 'prettier/prettier': ['error'],
81
-
82
- '@typescript-eslint/array-type': [
83
- 'error',
84
- {
85
- default: 'array-simple',
86
- readonly: 'array-simple'
87
- }
88
- ],
89
-
90
- '@typescript-eslint/await-thenable': ['error'],
91
- '@typescript-eslint/explicit-module-boundary-types': ['off'],
92
- '@typescript-eslint/explicit-member-accessibility': ['error'],
93
-
94
- '@typescript-eslint/member-ordering': [
95
- 'error',
96
- {
97
- default: ['static-field', 'static-method', 'instance-field', 'constructor', 'instance-method']
98
- }
99
- ],
100
-
101
- '@typescript-eslint/no-empty-function': [
102
- 'error',
103
- {
104
- allow: ['constructors']
105
- }
106
- ],
107
-
108
- '@typescript-eslint/no-floating-promises': ['error'],
109
- '@typescript-eslint/no-for-in-array': ['error'],
110
- '@typescript-eslint/no-misused-promises': ['error'],
111
- '@typescript-eslint/no-require-imports': ['error'],
112
- '@typescript-eslint/no-unsafe-assignment': ['off'],
113
- '@typescript-eslint/no-unsafe-call': ['off'],
114
- '@typescript-eslint/no-unsafe-member-access': ['off'],
115
- '@typescript-eslint/no-unsafe-return': ['off'],
116
-
117
- '@typescript-eslint/no-unused-vars': [
118
- 'error',
119
- {
120
- args: 'all',
121
- argsIgnorePattern: '^_',
122
- caughtErrors: 'all',
123
- vars: 'all',
124
- varsIgnorePattern: '^_'
125
- }
126
- ],
127
-
128
- '@typescript-eslint/no-useless-constructor': ['error'],
129
- '@typescript-eslint/prefer-for-of': ['error'],
130
-
131
- '@typescript-eslint/prefer-nullish-coalescing': [
132
- 'error',
133
- {
134
- ignoreMixedLogicalExpressions: true
135
- }
136
- ],
137
-
138
- '@typescript-eslint/prefer-readonly': ['error'],
139
-
140
- '@typescript-eslint/promise-function-async': [
141
- 'error',
142
- {
143
- checkArrowFunctions: false
144
- }
145
- ],
146
-
147
- '@typescript-eslint/restrict-template-expressions': [
148
- 'error',
149
- {
150
- allowNumber: true,
151
- allowBoolean: true,
152
- allowAny: true,
153
- allowNullish: true
154
- }
155
- ],
156
-
157
- '@typescript-eslint/require-await': ['error'],
158
- '@typescript-eslint/return-await': ['error', 'in-try-catch'],
159
- '@typescript-eslint/switch-exhaustiveness-check': ['error'],
160
- complexity: ['off'],
161
- 'dot-notation': ['error'],
162
-
163
- eqeqeq: [
164
- 'error',
165
- 'always',
166
- {
167
- null: 'ignore'
168
- }
169
- ],
170
-
171
- 'import/no-duplicates': ['error'],
172
-
173
- 'import/no-extraneous-dependencies': [
174
- 'error',
175
- {
176
- devDependencies: ['**/test/**', '**/*.test.ts'], // Only allow importing devDependencies from tests
177
- optionalDependencies: false, // Disallow importing optional dependencies (those shouldn't be used here)
178
- peerDependencies: false // Disallow importing peer dependencies (those shouldn't be used here)
179
- }
180
- ],
181
-
182
- 'import/no-unresolved': [
183
- 'error',
184
- {
185
- ignore: [
186
- '@jsii/check-node/run', // @jsii/check-node uses an export map, which import/resolver does not (yet) support (https://github.com/import-js/eslint-plugin-import/issues/1868)
187
- 'worker_threads' // This isn't supported in all node versions (import is always guarded)
188
- ]
189
- }
190
- ],
191
-
192
- 'import/order': [
193
- 'error',
194
- {
195
- alphabetize: {
196
- order: 'asc',
197
- caseInsensitive: true
198
- },
199
-
200
- groups: [
201
- ['builtin', 'external'],
202
- ['parent', 'sibling'],
203
- ['index', 'unknown']
204
- ],
205
- 'newlines-between': 'always'
206
- }
207
- ],
208
-
209
- 'no-alert': ['error'],
210
- 'no-await-in-loop': ['error'],
211
- 'no-caller': ['error'],
212
-
213
- 'no-else-return': [
214
- 'error',
215
- {
216
- allowElseIf: true
217
- }
218
- ],
219
-
220
- 'no-eval': ['error'],
221
- 'no-extra-bind': ['error'],
222
- 'no-implied-eval': ['error'],
223
- 'no-lone-blocks': ['error'],
224
- 'no-new-symbol': ['error'],
225
- 'no-proto': ['error'],
226
-
227
- 'no-restricted-properties': [
228
- 'error',
229
- {
230
- property: 'substr',
231
- message: 'Use .slice instead of .substr.'
232
- }
233
- ],
234
-
235
- 'no-return-await': ['error'],
236
- 'no-unused-expressions': ['error'],
237
- 'no-useless-call': ['error'],
238
- 'no-var': ['error'],
239
- 'prefer-const': ['error'],
240
- 'prefer-template': ['error'],
241
- 'eol-last': ['error', 'always'],
242
- // Disabled rules
243
- '@typescript-eslint/explicit-function-return-type': 'off',
244
- '@typescript-eslint/interface-name-prefix': 'off',
245
- '@typescript-eslint/no-explicit-any': 'off',
246
- '@typescript-eslint/no-non-null-assertion': 'off',
247
- '@typescript-eslint/no-use-before-define': 'off',
248
- '@typescript-eslint/unbound-method': 'off',
249
- 'no-case-declarations': 'off',
250
- 'require-atomic-updates': 'off',
251
- // This is not a bad rule but it got sprung on us and our code loudly fails it
252
- // Disable to get the eslint upgrade to pass.
253
- '@typescript-eslint/no-unsafe-argument': 'off',
254
- // 'consistent-return' actually decreases safety. Its use will enforce useless `throws`
255
- // statements, forcing a runtime error that occlude cases where the TypeScript type
256
- // checker would actually have caught something like a non-exhaustive `switch` statement
257
- // at compile time.
258
- 'consistent-return': 'off'
259
- }
260
- }
261
- ];
package/jest.config.js DELETED
@@ -1,13 +0,0 @@
1
- module.exports = {
2
- roots: ['<rootDir>/'],
3
- transform: {
4
- '^.+\\.(ts|tsx)$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.test.json' }],
5
- },
6
- testRegex: '(/__tests__/.*|(\\.)(test|spec))\\.tsx?$',
7
- moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node', 'css'],
8
- moduleDirectories: ['node_modules', 'src'],
9
- transformIgnorePatterns: [],
10
- modulePathIgnorePatterns: ['<rootDir>/dist/__mocks__/'],
11
- collectCoverageFrom: ['src/**/*.ts', '!src/**/*.test.{js,jsx,ts,tsx}'],
12
- testEnvironment: 'node'
13
- };
@@ -1,341 +0,0 @@
1
- import {
2
- BadRequestError,
3
- InternalServerError,
4
- NotFoundError,
5
- ConflictError,
6
- UnauthorizedError,
7
- ForbiddenError,
8
- HttpError,
9
- createErrorFromStatusCode,
10
- createClientError,
11
- createNetworkError
12
- } from './errors';
13
-
14
- describe('errors', () => {
15
- describe('HttpError for unhandled status codes', () => {
16
- test('creates error with correct properties', () => {
17
- const status = 418;
18
- const message = 'I am a teapot';
19
-
20
- const error = new HttpError(status, message);
21
-
22
- expect(error).toBeInstanceOf(Error);
23
- expect(error).toBeInstanceOf(HttpError);
24
- expect(error.name).toBe('Error');
25
- expect(error.message).toBe(message);
26
- expect(error.status).toBe(status);
27
- expect(error.title).toBeUndefined(); // HttpError doesn't set title by default
28
- });
29
-
30
- test('has consistent interface with other error types', () => {
31
- const error = new HttpError(422, 'Test message');
32
-
33
- expect(error.message).toBe('Test message');
34
- expect(error.status).toBe(422);
35
-
36
- // Should have the same interface as other HttpError types
37
- expect('status' in error).toBe(true);
38
- expect('message' in error).toBe(true);
39
- });
40
-
41
- test('has proper stack trace', () => {
42
- const error = new HttpError(500, 'Test error');
43
- expect(error.stack).toBeDefined();
44
- expect(error.stack).toContain('Test error');
45
- });
46
- });
47
-
48
- describe('createErrorFromStatusCode', () => {
49
- test('creates BadRequestError for status 400', () => {
50
- const message = 'Invalid request';
51
- const error = createErrorFromStatusCode(400, message);
52
-
53
- expect(error).toBeInstanceOf(BadRequestError);
54
- expect(error.message).toBe('SABS API Error (400): Invalid request');
55
- });
56
-
57
- test('creates UnauthorizedError for status 401', () => {
58
- const message = 'Invalid credentials';
59
- const error = createErrorFromStatusCode(401, message);
60
-
61
- expect(error).toBeInstanceOf(UnauthorizedError);
62
- expect(error.message).toBe('SABS API Error (401): Invalid credentials');
63
- });
64
-
65
- test('creates ForbiddenError for status 403', () => {
66
- const message = 'Access denied';
67
- const error = createErrorFromStatusCode(403, message);
68
-
69
- expect(error).toBeInstanceOf(ForbiddenError);
70
- expect(error.message).toBe('SABS API Error (403): Access denied');
71
- });
72
-
73
- test('creates NotFoundError for status 404', () => {
74
- const message = 'Resource not found';
75
- const error = createErrorFromStatusCode(404, message);
76
-
77
- expect(error).toBeInstanceOf(NotFoundError);
78
- expect(error.message).toBe('SABS API Error (404): Resource not found');
79
- });
80
-
81
- test('creates ConflictError for status 409', () => {
82
- const message = 'Resource conflict';
83
- const error = createErrorFromStatusCode(409, message);
84
-
85
- expect(error).toBeInstanceOf(ConflictError);
86
- expect(error.message).toBe('SABS API Error (409): Resource conflict');
87
- });
88
-
89
- test.each([500, 502, 503, 504])('creates InternalServerError for status %s', (statusCode) => {
90
- const message = 'Server error';
91
- const error = createErrorFromStatusCode(statusCode, message);
92
-
93
- expect(error).toBeInstanceOf(InternalServerError);
94
- expect(error.message).toBe(`SABS API Error (${statusCode}): Server error`);
95
- });
96
-
97
- test('creates HttpError for unhandled status codes', () => {
98
- const statusCode = 418; // I'm a teapot
99
- const message = 'Teapot error';
100
-
101
- const error = createErrorFromStatusCode(statusCode, message);
102
-
103
- expect(error).toBeInstanceOf(HttpError);
104
- expect(error.message).toBe('SABS API Error (418): Teapot error');
105
-
106
- if (error instanceof HttpError) {
107
- expect(error.status).toBe(statusCode);
108
- }
109
- });
110
-
111
- test('handles edge case status codes', () => {
112
- // Test some edge cases
113
- const testCases = [
114
- { status: 100, expected: HttpError },
115
- { status: 200, expected: HttpError },
116
- { status: 300, expected: HttpError },
117
- { status: 451, expected: HttpError }, // Unavailable For Legal Reasons
118
- { status: 999, expected: HttpError }
119
- ];
120
-
121
- testCases.forEach(({ status, expected }) => {
122
- const error = createErrorFromStatusCode(status, 'Test message');
123
- expect(error).toBeInstanceOf(expected);
124
- });
125
- });
126
-
127
- test('all error types have consistent HttpError interface', () => {
128
- const testCases = [
129
- { statusCode: 400, expectedType: BadRequestError, expectedTitle: 'Bad request' },
130
- { statusCode: 500, expectedType: InternalServerError, expectedTitle: 'Internal server error' },
131
- { statusCode: 418, expectedType: HttpError, expectedTitle: undefined }
132
- ];
133
-
134
- testCases.forEach(({ statusCode, expectedType, expectedTitle }) => {
135
- const error = createErrorFromStatusCode(statusCode, 'Test message');
136
-
137
- expect(error).toBeInstanceOf(expectedType);
138
- expect(error.message).toBe(`SABS API Error (${statusCode}): Test message`);
139
-
140
- // All error types should have consistent HttpError interface
141
- expect('status' in error).toBe(true);
142
- if ('status' in error) {
143
- expect(error.status).toBe(statusCode);
144
- }
145
- if ('title' in error) {
146
- expect(error.title).toBe(expectedTitle);
147
- }
148
- });
149
- });
150
-
151
- test('returns standard error types for known status codes', () => {
152
- const testCases = [
153
- { status: 400, expectedType: BadRequestError },
154
- { status: 401, expectedType: UnauthorizedError },
155
- { status: 403, expectedType: ForbiddenError },
156
- { status: 404, expectedType: NotFoundError },
157
- { status: 409, expectedType: ConflictError },
158
- { status: 500, expectedType: InternalServerError },
159
- { status: 502, expectedType: InternalServerError },
160
- { status: 503, expectedType: InternalServerError },
161
- { status: 504, expectedType: InternalServerError }
162
- ];
163
-
164
- testCases.forEach(({ status, expectedType }) => {
165
- const error = createErrorFromStatusCode(status, 'Test message');
166
-
167
- expect(error).toBeInstanceOf(Error);
168
- expect(error).toBeInstanceOf(expectedType);
169
- expect(error.name).toBe('Error'); // Shared library errors use 'Error' as name
170
- expect(error.message).toBe(`SABS API Error (${status}): Test message`);
171
- });
172
- });
173
- });
174
-
175
- describe('createClientError', () => {
176
- test('creates BadRequestError with client error prefix', () => {
177
- const message = 'Missing required parameter';
178
- const error = createClientError(message);
179
-
180
- expect(error).toBeInstanceOf(BadRequestError);
181
- expect(error.message).toBe('SABS Client Error: Missing required parameter');
182
- });
183
-
184
- test('handles empty message', () => {
185
- const error = createClientError('');
186
- expect(error.message).toBe('SABS Client Error: ');
187
- });
188
-
189
- test('handles special characters in message', () => {
190
- const message = 'Invalid characters: <>&"\'';
191
- const error = createClientError(message);
192
- expect(error.message).toBe(`SABS Client Error: ${message}`);
193
- });
194
- });
195
-
196
- describe('createNetworkError', () => {
197
- test('creates InternalServerError with network error prefix', () => {
198
- const message = 'Connection refused';
199
- const error = createNetworkError(message);
200
-
201
- expect(error).toBeInstanceOf(InternalServerError);
202
- expect(error.message).toBe('SABS Network Error: Connection refused');
203
- });
204
-
205
- test('includes original error message when provided', () => {
206
- const message = 'Request failed';
207
- const originalError = new Error('ECONNREFUSED');
208
- const error = createNetworkError(message, originalError);
209
-
210
- expect(error).toBeInstanceOf(InternalServerError);
211
- expect(error.message).toBe('SABS Network Error: Request failed (caused by: ECONNREFUSED)');
212
- });
213
-
214
- test('handles original error without message', () => {
215
- const message = 'Network issue';
216
- const originalError = new Error(); // Empty message
217
- const error = createNetworkError(message, originalError);
218
-
219
- expect(error.message).toBe('SABS Network Error: Network issue (caused by: )');
220
- });
221
-
222
- test('handles null original error', () => {
223
- const message = 'Unknown network error';
224
- const error = createNetworkError(message, undefined);
225
-
226
- expect(error.message).toBe('SABS Network Error: Unknown network error');
227
- });
228
- });
229
-
230
- describe('error inheritance and instanceof checks', () => {
231
- test('all error types are instances of Error', () => {
232
- const errors = [
233
- createErrorFromStatusCode(400, 'Bad Request'),
234
- createErrorFromStatusCode(401, 'Unauthorized'),
235
- createErrorFromStatusCode(403, 'Forbidden'),
236
- createErrorFromStatusCode(404, 'Not Found'),
237
- createErrorFromStatusCode(409, 'Conflict'),
238
- createErrorFromStatusCode(500, 'Internal Server Error'),
239
- createErrorFromStatusCode(418, 'Teapot'),
240
- createClientError('Client error'),
241
- createNetworkError('Network error'),
242
- new HttpError(422, 'Custom error')
243
- ];
244
-
245
- errors.forEach((error) => {
246
- expect(error).toBeInstanceOf(Error);
247
- expect(error.message).toBeDefined();
248
- expect(typeof error.message).toBe('string');
249
- expect(error.name).toBeDefined();
250
- });
251
- });
252
-
253
- test('error types can be distinguished via instanceof', () => {
254
- const badRequestError = createErrorFromStatusCode(400, 'Bad Request');
255
- const unauthorizedError = createErrorFromStatusCode(401, 'Unauthorized');
256
- const notFoundError = createErrorFromStatusCode(404, 'Not Found');
257
- const httpError = createErrorFromStatusCode(418, 'Teapot');
258
-
259
- // All errors extend HttpError, so they're all instances of HttpError
260
- expect(badRequestError).toBeInstanceOf(BadRequestError);
261
- expect(badRequestError).toBeInstanceOf(HttpError);
262
- expect(badRequestError).not.toBeInstanceOf(UnauthorizedError);
263
-
264
- expect(unauthorizedError).toBeInstanceOf(UnauthorizedError);
265
- expect(unauthorizedError).toBeInstanceOf(HttpError);
266
- expect(unauthorizedError).not.toBeInstanceOf(BadRequestError);
267
-
268
- expect(notFoundError).toBeInstanceOf(NotFoundError);
269
- expect(notFoundError).toBeInstanceOf(HttpError);
270
- expect(notFoundError).not.toBeInstanceOf(BadRequestError);
271
-
272
- expect(httpError).toBeInstanceOf(HttpError);
273
- expect(httpError).not.toBeInstanceOf(BadRequestError);
274
- });
275
- });
276
-
277
- describe('error serialization and JSON handling', () => {
278
- test('errors can be converted to JSON for logging', () => {
279
- const error = new HttpError(422, 'Test error');
280
-
281
- // Test that error properties are accessible for logging
282
- const logObject = {
283
- message: error.message,
284
- name: error.name,
285
- status: error.status,
286
- title: error.title
287
- };
288
-
289
- expect(logObject.message).toBe('Test error');
290
- expect(logObject.name).toBe('Error');
291
- expect(logObject.status).toBe(422);
292
- expect(logObject.title).toBeUndefined();
293
- });
294
-
295
- test('shared error types have basic error properties', () => {
296
- const error = createErrorFromStatusCode(400, 'Validation failed');
297
-
298
- const logObject = {
299
- message: error.message,
300
- name: error.name,
301
- stack: error.stack
302
- };
303
-
304
- expect(logObject.message).toBe('SABS API Error (400): Validation failed');
305
- expect(logObject.name).toBeDefined();
306
- expect(logObject.stack).toBeDefined();
307
- });
308
- });
309
-
310
- describe('edge cases and error conditions', () => {
311
- test('handles undefined and null inputs gracefully', () => {
312
- // These should not throw, but create errors with undefined/null content
313
- expect(() => createErrorFromStatusCode(400, undefined as any)).not.toThrow();
314
- expect(() => createErrorFromStatusCode(400, null as any)).not.toThrow();
315
- expect(() => createClientError(undefined as any)).not.toThrow();
316
- expect(() => createNetworkError(undefined as any)).not.toThrow();
317
- });
318
-
319
- test('handles very large status codes', () => {
320
- const error = createErrorFromStatusCode(999999, 'Large status code');
321
- expect(error).toBeInstanceOf(HttpError);
322
- if (error instanceof HttpError) {
323
- expect(error.status).toBe(999999);
324
- }
325
- });
326
-
327
- test('handles negative status codes', () => {
328
- const error = createErrorFromStatusCode(-1, 'Negative status code');
329
- expect(error).toBeInstanceOf(HttpError);
330
- if (error instanceof HttpError) {
331
- expect(error.status).toBe(-1);
332
- }
333
- });
334
-
335
- test('handles very long error messages', () => {
336
- const longMessage = 'x'.repeat(10000);
337
- const error = createErrorFromStatusCode(400, longMessage);
338
- expect(error.message).toContain(longMessage);
339
- });
340
- });
341
- });