Improve error messages #417
Test suite run failed
Failed tests: 7/639. Failed suites: 5/32.
Details
Created failed tests' annotations. To disable them, see documentation.
● Content Validation - Comprehensive Test Suite › Query Validation › should validate field UID in query operations
expect(jest.fn()).toHaveBeenCalledTimes(expected)
Expected number of calls: 3
Received number of calls: 1
662 | // Check that console.error was called for invalid field UIDs
663 | expect(consoleSpy).toHaveBeenCalledWith(ErrorMessages.INVALID_FIELD_UID);
> 664 | expect(consoleSpy).toHaveBeenCalledTimes(3);
| ^
665 |
666 | consoleSpy.mockRestore();
667 | });
at Object.<anonymous> (test/unit/content-validation-comprehensive.spec.ts:664:26)
● Content Validation - Comprehensive Test Suite › Query Validation › should validate query value types
expect(jest.fn()).toHaveBeenCalledTimes(expected)
Expected number of calls: 2
Received number of calls: 4
716 |
717 | expect(consoleSpy).toHaveBeenCalledWith(ErrorMessages.INVALID_VALUE_STRING_OR_NUMBER);
> 718 | expect(consoleSpy).toHaveBeenCalledTimes(2);
| ^
719 |
720 | consoleSpy.mockRestore();
721 | });
at Object.<anonymous> (test/unit/content-validation-comprehensive.spec.ts:718:26)
● Query Optimization - Comprehensive Test Suite › Parameter Validation › should validate value types for comparison operations
expect(jest.fn()).toHaveBeenCalledTimes(expected)
Expected number of calls: 3
Received number of calls: 4
241 |
242 | expect(consoleSpy).toHaveBeenCalledWith(ErrorMessages.INVALID_VALUE_STRING_OR_NUMBER);
> 243 | expect(consoleSpy).toHaveBeenCalledTimes(3);
| ^
244 |
245 | consoleSpy.mockRestore();
246 | });
at Object.<anonymous> (test/unit/query-optimization-comprehensive.spec.ts:243:26)
● Query class › validation error handling › should throw error when whereIn() receives invalid referenceUid
expect(received).toThrow(expected)
Expected substring: "Invalid referenceUid: Must be alphanumeric."
Received message: "Invalid referenceUid: invalid@ref!. Must be alphanumeric."
136 | // eslint-disable-next-line @typescript-eslint/naming-convention, prettier/prettier
137 | if (!this.isValidAlphanumeric(referenceUid)) {
> 138 | throw new Error(ErrorMessages.INVALID_REFERENCE_UID(referenceUid));
| ^
139 | }
140 | this._parameters[referenceUid] = { '$in_query': queryInstance._parameters };
141 | return this;
at Query.whereIn (src/lib/query.ts:138:13)
at test/unit/query.spec.ts:341:26
at Object.<anonymous> (node_modules/expect/build/toThrowMatchers.js:74:11)
at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:320:21)
at Object.<anonymous> (test/unit/query.spec.ts:341:61)
at Object.<anonymous> (test/unit/query.spec.ts:341:61)
● Query class › validation error handling › should throw error when whereNotIn() receives invalid referenceUid
expect(received).toThrow(expected)
Expected substring: "Invalid referenceUid: Must be alphanumeric."
Received message: "Invalid referenceUid: invalid@ref!. Must be alphanumeric."
161 | // eslint-disable-next-line @typescript-eslint/naming-convention, prettier/prettier
162 | if (!this.isValidAlphanumeric(referenceUid)) {
> 163 | throw new Error(ErrorMessages.INVALID_REFERENCE_UID(referenceUid));
| ^
164 | }
165 | this._parameters[referenceUid] = { '$nin_query': queryInstance._parameters };
166 | return this;
at Query.whereNotIn (src/lib/query.ts:163:13)
at test/unit/query.spec.ts:346:26
at Object.<anonymous> (node_modules/expect/build/toThrowMatchers.js:74:11)
at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:320:21)
at Object.<anonymous> (test/unit/query.spec.ts:346:64)
at Object.<anonymous> (test/unit/query.spec.ts:346:64)
● Entries class › should log error when includeReference called with no arguments
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: "Argument should be a String or an Array."
Received: "Invalid argument. Provide a string or an array and try again."
Number of calls: 1
47 | const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation();
48 | entry.includeReference();
> 49 | expect(consoleErrorSpy).toHaveBeenCalledWith('Argument should be a String or an Array.');
| ^
50 | consoleErrorSpy.mockRestore();
51 | });
52 |
at Object.<anonymous> (test/unit/entries.spec.ts:49:29)
● Entry class › should log error when includeReference called with no arguments
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: "Argument should be a String or an Array."
Received: "Invalid argument. Provide a string or an array and try again."
Number of calls: 1
53 | const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation();
54 | entry.includeReference();
> 55 | expect(consoleErrorSpy).toHaveBeenCalledWith('Argument should be a String or an Array.');
| ^
56 | consoleErrorSpy.mockRestore();
57 | });
58 |
at Object.<anonymous> (test/unit/entry.spec.ts:55:29)
Annotations
Check failure on line 646 in test/unit/content-validation-comprehensive.spec.ts
github-actions / Tests annotations (🧪 jest-coverage-report-action)
Content Validation - Comprehensive Test Suite > Query Validation > should validate field UID in query operations
Error: expect(jest.fn()).toHaveBeenCalledTimes(expected)
Expected number of calls: 3
Received number of calls: 1
at Object.<anonymous> (/home/runner/work/contentstack-typescript/contentstack-typescript/test/unit/content-validation-comprehensive.spec.ts:664:26)
at Promise.then.completed (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:298:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:231:10)
at _callCircusTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:316:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:252:3)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:126:9)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:121:9)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:121:9)
at run (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:71:3)
at runAndTransformResultsToJestFormat (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
at jestAdapter (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
at runTestInternal (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:367:16)
at runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:444:34)
at Object.worker (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/testWorker.js:106:12)
Check failure on line 702 in test/unit/content-validation-comprehensive.spec.ts
github-actions / Tests annotations (🧪 jest-coverage-report-action)
Content Validation - Comprehensive Test Suite > Query Validation > should validate query value types
Error: expect(jest.fn()).toHaveBeenCalledTimes(expected)
Expected number of calls: 2
Received number of calls: 4
at Object.<anonymous> (/home/runner/work/contentstack-typescript/contentstack-typescript/test/unit/content-validation-comprehensive.spec.ts:718:26)
at Promise.then.completed (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:298:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:231:10)
at _callCircusTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:316:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:252:3)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:126:9)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:121:9)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:121:9)
at run (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:71:3)
at runAndTransformResultsToJestFormat (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
at jestAdapter (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
at runTestInternal (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:367:16)
at runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:444:34)
at Object.worker (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/testWorker.js:106:12)
Check failure on line 227 in test/unit/query-optimization-comprehensive.spec.ts
github-actions / Tests annotations (🧪 jest-coverage-report-action)
Query Optimization - Comprehensive Test Suite > Parameter Validation > should validate value types for comparison operations
Error: expect(jest.fn()).toHaveBeenCalledTimes(expected)
Expected number of calls: 3
Received number of calls: 4
at Object.<anonymous> (/home/runner/work/contentstack-typescript/contentstack-typescript/test/unit/query-optimization-comprehensive.spec.ts:243:26)
at Promise.then.completed (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:298:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:231:10)
at _callCircusTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:316:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:252:3)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:126:9)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:121:9)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:121:9)
at run (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:71:3)
at runAndTransformResultsToJestFormat (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
at jestAdapter (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
at runTestInternal (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:367:16)
at runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:444:34)
at Object.worker (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/testWorker.js:106:12)
Check failure on line 339 in test/unit/query.spec.ts
github-actions / Tests annotations (🧪 jest-coverage-report-action)
Query class > validation error handling > should throw error when whereIn() receives invalid referenceUid
Error: expect(received).toThrow(expected)
Expected substring: "Invalid referenceUid: Must be alphanumeric."
Received message: "Invalid referenceUid: invalid@ref!. Must be alphanumeric."
136 | // eslint-disable-next-line @typescript-eslint/naming-convention, prettier/prettier
137 | if (!this.isValidAlphanumeric(referenceUid)) {
> 138 | throw new Error(ErrorMessages.INVALID_REFERENCE_UID(referenceUid));
| ^
139 | }
140 | this._parameters[referenceUid] = { '$in_query': queryInstance._parameters };
141 | return this;
at Query.whereIn (src/lib/query.ts:138:13)
at test/unit/query.spec.ts:341:26
at Object.<anonymous> (node_modules/expect/build/toThrowMatchers.js:74:11)
at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:320:21)
at Object.<anonymous> (test/unit/query.spec.ts:341:61)
at Object.<anonymous> (/home/runner/work/contentstack-typescript/contentstack-typescript/test/unit/query.spec.ts:341:61)
at Promise.then.completed (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:298:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:231:10)
at _callCircusTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:316:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:252:3)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:126:9)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:121:9)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:121:9)
at run (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:71:3)
at runAndTransformResultsToJestFormat (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
at jestAdapter (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
at runTestInternal (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:367:16)
at runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:444:34)
at Object.worker (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/testWorker.js:106:12)
Check failure on line 344 in test/unit/query.spec.ts
github-actions / Tests annotations (🧪 jest-coverage-report-action)
Query class > validation error handling > should throw error when whereNotIn() receives invalid referenceUid
Error: expect(received).toThrow(expected)
Expected substring: "Invalid referenceUid: Must be alphanumeric."
Received message: "Invalid referenceUid: invalid@ref!. Must be alphanumeric."
161 | // eslint-disable-next-line @typescript-eslint/naming-convention, prettier/prettier
162 | if (!this.isValidAlphanumeric(referenceUid)) {
> 163 | throw new Error(ErrorMessages.INVALID_REFERENCE_UID(referenceUid));
| ^
164 | }
165 | this._parameters[referenceUid] = { '$nin_query': queryInstance._parameters };
166 | return this;
at Query.whereNotIn (src/lib/query.ts:163:13)
at test/unit/query.spec.ts:346:26
at Object.<anonymous> (node_modules/expect/build/toThrowMatchers.js:74:11)
at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:320:21)
at Object.<anonymous> (test/unit/query.spec.ts:346:64)
at Object.<anonymous> (/home/runner/work/contentstack-typescript/contentstack-typescript/test/unit/query.spec.ts:346:64)
at Promise.then.completed (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:298:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:231:10)
at _callCircusTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:316:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:252:3)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:126:9)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:121:9)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:121:9)
at run (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:71:3)
at runAndTransformResultsToJestFormat (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
at jestAdapter (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
at runTestInternal (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:367:16)
at runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:444:34)
at Object.worker (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/testWorker.js:106:12)
Check failure on line 46 in test/unit/entries.spec.ts
github-actions / Tests annotations (🧪 jest-coverage-report-action)
Entries class > should log error when includeReference called with no arguments
Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: "Argument should be a String or an Array."
Received: "Invalid argument. Provide a string or an array and try again."
Number of calls: 1
at Object.<anonymous> (/home/runner/work/contentstack-typescript/contentstack-typescript/test/unit/entries.spec.ts:49:29)
at Promise.then.completed (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:298:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:231:10)
at _callCircusTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:316:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:252:3)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:126:9)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:121:9)
at run (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:71:3)
at runAndTransformResultsToJestFormat (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
at jestAdapter (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
at runTestInternal (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:367:16)
at runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:444:34)
at Object.worker (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/testWorker.js:106:12)
Check failure on line 52 in test/unit/entry.spec.ts
github-actions / Tests annotations (🧪 jest-coverage-report-action)
Entry class > should log error when includeReference called with no arguments
Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: "Argument should be a String or an Array."
Received: "Invalid argument. Provide a string or an array and try again."
Number of calls: 1
at Object.<anonymous> (/home/runner/work/contentstack-typescript/contentstack-typescript/test/unit/entry.spec.ts:55:29)
at Promise.then.completed (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:298:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/utils.js:231:10)
at _callCircusTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:316:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:252:3)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:126:9)
at _runTestsForDescribeBlock (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:121:9)
at run (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/run.js:71:3)
at runAndTransformResultsToJestFormat (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
at jestAdapter (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
at runTestInternal (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:367:16)
at runTest (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/runTest.js:444:34)
at Object.worker (/home/runner/work/contentstack-typescript/contentstack-typescript/node_modules/jest-runner/build/testWorker.js:106:12)