-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-validation.js
More file actions
38 lines (32 loc) · 937 Bytes
/
Copy pathtest-validation.js
File metadata and controls
38 lines (32 loc) · 937 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
31
32
33
34
35
36
37
38
// Test that TypeScript types work correctly without requiring 'as any' casts
const { SmashSend } = require('./dist');
// Create a mock React element
const mockReactElement = {
type: 'div',
props: { children: 'Hello' },
key: null,
};
const client = new SmashSend('test-key');
// Test 1: Sending with HTML (should work)
const htmlEmail = {
from: 'test@example.com',
to: 'recipient@example.com',
subject: 'Test',
html: '<p>Hello</p>',
};
// Test 2: Sending with React (should work)
const reactEmail = {
from: 'test@example.com',
to: 'recipient@example.com',
subject: 'Test',
react: mockReactElement,
};
// Test 3: Sending with both HTML and React (should work - react takes precedence)
const bothEmail = {
from: 'test@example.com',
to: 'recipient@example.com',
subject: 'Test',
html: '<p>Fallback</p>',
react: mockReactElement,
};
console.log('✅ All type tests passed - no "as any" casts needed!');