forked from Lilly-Protocol/lily-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors-surface.test.ts
More file actions
30 lines (26 loc) · 1012 Bytes
/
Copy patherrors-surface.test.ts
File metadata and controls
30 lines (26 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { describe, it, expect } from 'vitest';
import * as errors from '../src/errors';
describe('error exports surface', () => {
it('exports LilyValidationError', () => {
expect(
Object.prototype.hasOwnProperty.call(errors, 'LilyValidationError'),
).toBe(true);
});
it('exports isLilySdkError type guard', () => {
expect(Object.prototype.hasOwnProperty.call(errors, 'isLilySdkError')).toBe(
true,
);
});
it('exports core error classes', () => {
expect(errors.LilySdkError).toBeDefined();
expect(errors.LilyConfigError).toBeDefined();
expect(errors.LilyTransportError).toBeDefined();
expect(errors.LilyAuthenticationError).toBeDefined();
expect(errors.LilyApiError).toBeDefined();
});
it('isLilySdkError type guard works correctly', () => {
expect(errors.isLilySdkError(new errors.LilySdkError('test'))).toBe(true);
expect(errors.isLilySdkError('not an error')).toBe(false);
expect(errors.isLilySdkError(null)).toBe(false);
});
});