Skip to content

Commit 29f91a4

Browse files
committed
test(sdk): add SDK configuration edge case tests
Add tests for SDK instantiation with various configuration options: - Minimal configuration (token only) - All options specified - Zero retries - Custom timeout - Custom retry delay These tests improve code coverage by validating constructor behavior with different option combinations.
1 parent 46c6686 commit 29f91a4

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/** @fileoverview Tests for Socket SDK edge cases and error branches. */
2+
3+
import { describe, expect, it } from 'vitest'
4+
5+
import { SocketSdk } from '../../src/index'
6+
7+
describe('SocketSdk - Edge Cases and Error Branches', () => {
8+
describe('SDK configuration', () => {
9+
it('should handle SDK with minimal configuration', () => {
10+
const sdk = new SocketSdk('test-token')
11+
expect(sdk).toBeInstanceOf(SocketSdk)
12+
})
13+
14+
it('should handle SDK with all options', () => {
15+
const sdk = new SocketSdk('test-token', {
16+
baseUrl: 'https://custom.api.dev',
17+
timeout: 60000,
18+
retries: 5,
19+
retryDelay: 2000,
20+
})
21+
expect(sdk).toBeInstanceOf(SocketSdk)
22+
})
23+
24+
it('should handle SDK with zero retries', () => {
25+
const sdk = new SocketSdk('test-token', {
26+
retries: 0,
27+
})
28+
expect(sdk).toBeInstanceOf(SocketSdk)
29+
})
30+
31+
it('should handle SDK with custom timeout', () => {
32+
const sdk = new SocketSdk('test-token', {
33+
timeout: 5000,
34+
})
35+
expect(sdk).toBeInstanceOf(SocketSdk)
36+
})
37+
38+
it('should handle SDK with custom retry delay', () => {
39+
const sdk = new SocketSdk('test-token', {
40+
retryDelay: 500,
41+
})
42+
expect(sdk).toBeInstanceOf(SocketSdk)
43+
})
44+
})
45+
})

0 commit comments

Comments
 (0)