import { expect, describe, it } from 'vitest'; import { PrexSDKError, normalizeErrorFn } from './index'; describe('errors', () => { it('should have a get PrexSDKError', () => { expect(PrexSDKError).toBeDefined(); }); it('should normalize error', () => { const error = normalizeErrorFn('test')(new Error('test error')); expect(error.message).toBe('test error'); }); it('should create PrexSDKError with policy_violation from error', () => { const error = PrexSDKError.fromError(new Error('rule check failed')); expect(error.error).toBe('policy_violation'); }); it('should create PrexSDKError with unsupported_chain_id from error', () => { const error = PrexSDKError.fromError(new Error('Unsupported chainId')); expect(error.error).toBe('unsupported_chain_id'); }); });