Skip to content

Commit

Permalink
add a simple unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Jan 16, 2024
1 parent c3f73e6 commit 8fc7385
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/workflow/test/errors/node.error.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { mock } from 'jest-mock-extended';
import type { INode } from '@/Interfaces';
import { NodeApiError } from '@/errors/node-api.error';
import { NodeOperationError } from '@/errors/node-operation.error';

describe('NodeError', () => {
const node = mock<INode>();

it('should prevent errors from being re-wrapped', () => {
const apiError = new NodeApiError(node, mock({ message: 'Some error happened', code: 500 }));
const opsError = new NodeOperationError(node, mock());

expect(new NodeOperationError(node, apiError)).toEqual(apiError);
expect(new NodeOperationError(node, opsError)).toEqual(opsError);
});
});

0 comments on commit 8fc7385

Please sign in to comment.