toiljs 0.0.98 → 0.0.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/build/compiler/.tsbuildinfo +1 -1
- package/build/compiler/docs.js +15 -0
- package/build/compiler/toil-docs.generated.js +1 -1
- package/build/devserver/.tsbuildinfo +1 -1
- package/build/devserver/email/console.d.ts +4 -0
- package/build/devserver/email/console.js +199 -2
- package/docs/frontend/data-fetching.md +17 -0
- package/package.json +1 -1
- package/src/compiler/docs.ts +15 -0
- package/src/compiler/toil-docs.generated.ts +1 -1
- package/src/devserver/email/console.ts +231 -17
- package/test/email-console.test.ts +31 -1
|
@@ -5,7 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { describe, expect, it } from 'vitest';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
emailAction,
|
|
10
|
+
htmlToText,
|
|
11
|
+
parseColor,
|
|
12
|
+
renderEmailConsole,
|
|
13
|
+
renderHtmlBody,
|
|
14
|
+
} from '../src/devserver/email/console.js';
|
|
9
15
|
|
|
10
16
|
const confirmEmail = {
|
|
11
17
|
to: 'bob@gmail.com',
|
|
@@ -53,4 +59,28 @@ describe('dev email emulator', () => {
|
|
|
53
59
|
expect(box).toContain('┌');
|
|
54
60
|
expect(box).toContain('└');
|
|
55
61
|
});
|
|
62
|
+
|
|
63
|
+
it('parseColor: hex, short hex, rgb, and named colors', () => {
|
|
64
|
+
expect(parseColor('#ff0000')).toEqual([255, 0, 0]);
|
|
65
|
+
expect(parseColor('#0f0')).toEqual([0, 255, 0]);
|
|
66
|
+
expect(parseColor('rgb(10, 20, 30)')).toEqual([10, 20, 30]);
|
|
67
|
+
expect(parseColor('red')).toEqual([229, 57, 53]);
|
|
68
|
+
expect(parseColor('not-a-color')).toBeUndefined();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('renderHtmlBody: keeps text + link, splits paragraphs, wraps to width', () => {
|
|
72
|
+
const lines = renderHtmlBody(
|
|
73
|
+
'<p>Hi <b>there</b> & welcome</p>' +
|
|
74
|
+
'<p><a href="https://x.com/a?b=1">Open</a></p>',
|
|
75
|
+
40,
|
|
76
|
+
);
|
|
77
|
+
const joined = lines.map((l) => l.replace(/\[[0-9;]*m/g, '')).join('\n');
|
|
78
|
+
expect(joined).toContain('Hi there & welcome');
|
|
79
|
+
expect(joined).toContain('Open');
|
|
80
|
+
expect(joined).toContain('(https://x.com/a?b=1)');
|
|
81
|
+
// a blank separator line sits between the two paragraphs
|
|
82
|
+
expect(lines).toContain('');
|
|
83
|
+
// no line exceeds the wrap width (visible chars; color is off under vitest)
|
|
84
|
+
for (const l of lines) expect(l.replace(/\[[0-9;]*m/g, '').length).toBeLessThanOrEqual(40);
|
|
85
|
+
});
|
|
56
86
|
});
|