digital-tools 2.1.3 → 2.4.0
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +19 -0
- package/README.md +2 -0
- package/dist/client.d.ts +109 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +69 -0
- package/dist/client.js.map +1 -0
- package/dist/define.d.ts +2 -2
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js +21 -11
- package/dist/define.js.map +1 -1
- package/dist/function-ref.d.ts +229 -0
- package/dist/function-ref.d.ts.map +1 -0
- package/dist/function-ref.js +28 -0
- package/dist/function-ref.js.map +1 -0
- package/dist/function-sugar.d.ts +57 -0
- package/dist/function-sugar.d.ts.map +1 -0
- package/dist/function-sugar.js +79 -0
- package/dist/function-sugar.js.map +1 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -4
- package/dist/index.js.map +1 -1
- package/dist/providers/analytics/mixpanel.d.ts.map +1 -1
- package/dist/providers/analytics/mixpanel.js +21 -18
- package/dist/providers/analytics/mixpanel.js.map +1 -1
- package/dist/providers/calendar/cal-com.d.ts.map +1 -1
- package/dist/providers/calendar/cal-com.js +10 -10
- package/dist/providers/calendar/cal-com.js.map +1 -1
- package/dist/providers/calendar/google-calendar.d.ts.map +1 -1
- package/dist/providers/calendar/google-calendar.js +4 -4
- package/dist/providers/calendar/google-calendar.js.map +1 -1
- package/dist/providers/crm/hubspot.d.ts.map +1 -1
- package/dist/providers/crm/hubspot.js +107 -85
- package/dist/providers/crm/hubspot.js.map +1 -1
- package/dist/providers/development/github.d.ts.map +1 -1
- package/dist/providers/development/github.js +40 -43
- package/dist/providers/development/github.js.map +1 -1
- package/dist/providers/ecommerce/shopify.d.ts.map +1 -1
- package/dist/providers/ecommerce/shopify.js +79 -62
- package/dist/providers/ecommerce/shopify.js.map +1 -1
- package/dist/providers/email/resend.d.ts.map +1 -1
- package/dist/providers/email/resend.js +20 -16
- package/dist/providers/email/resend.js.map +1 -1
- package/dist/providers/email/sendgrid.d.ts.map +1 -1
- package/dist/providers/email/sendgrid.js +12 -9
- package/dist/providers/email/sendgrid.js.map +1 -1
- package/dist/providers/finance/stripe.d.ts.map +1 -1
- package/dist/providers/finance/stripe.js +44 -42
- package/dist/providers/finance/stripe.js.map +1 -1
- package/dist/providers/forms/typeform.d.ts.map +1 -1
- package/dist/providers/forms/typeform.js +68 -58
- package/dist/providers/forms/typeform.js.map +1 -1
- package/dist/providers/knowledge/notion.d.ts.map +1 -1
- package/dist/providers/knowledge/notion.js +75 -41
- package/dist/providers/knowledge/notion.js.map +1 -1
- package/dist/providers/marketing/mailchimp.d.ts.map +1 -1
- package/dist/providers/marketing/mailchimp.js +74 -61
- package/dist/providers/marketing/mailchimp.js.map +1 -1
- package/dist/providers/media/cloudinary.d.ts.map +1 -1
- package/dist/providers/media/cloudinary.js +30 -28
- package/dist/providers/media/cloudinary.js.map +1 -1
- package/dist/providers/messaging/slack.d.ts.map +1 -1
- package/dist/providers/messaging/slack.js +75 -58
- package/dist/providers/messaging/slack.js.map +1 -1
- package/dist/providers/messaging/twilio-sms.d.ts.map +1 -1
- package/dist/providers/messaging/twilio-sms.js +33 -15
- package/dist/providers/messaging/twilio-sms.js.map +1 -1
- package/dist/providers/project-management/linear.d.ts.map +1 -1
- package/dist/providers/project-management/linear.js +31 -27
- package/dist/providers/project-management/linear.js.map +1 -1
- package/dist/providers/spreadsheet/google-sheets.d.ts.map +1 -1
- package/dist/providers/spreadsheet/google-sheets.js +21 -18
- package/dist/providers/spreadsheet/google-sheets.js.map +1 -1
- package/dist/providers/spreadsheet/xlsx.d.ts.map +1 -1
- package/dist/providers/spreadsheet/xlsx.js +4 -4
- package/dist/providers/spreadsheet/xlsx.js.map +1 -1
- package/dist/providers/storage/index.js +1 -0
- package/dist/providers/storage/index.js.map +1 -1
- package/dist/providers/storage/s3.d.ts.map +1 -1
- package/dist/providers/storage/s3.js +36 -27
- package/dist/providers/storage/s3.js.map +1 -1
- package/dist/providers/support/zendesk.d.ts.map +1 -1
- package/dist/providers/support/zendesk.js +24 -25
- package/dist/providers/support/zendesk.js.map +1 -1
- package/dist/providers/tasks/todoist.d.ts.map +1 -1
- package/dist/providers/tasks/todoist.js +18 -18
- package/dist/providers/tasks/todoist.js.map +1 -1
- package/dist/providers/video-conferencing/google-meet.d.ts.map +1 -1
- package/dist/providers/video-conferencing/google-meet.js +11 -11
- package/dist/providers/video-conferencing/google-meet.js.map +1 -1
- package/dist/providers/video-conferencing/jitsi.js +14 -14
- package/dist/providers/video-conferencing/jitsi.js.map +1 -1
- package/dist/providers/video-conferencing/teams.d.ts.map +1 -1
- package/dist/providers/video-conferencing/teams.js +9 -7
- package/dist/providers/video-conferencing/teams.js.map +1 -1
- package/dist/providers/video-conferencing/zoom.d.ts.map +1 -1
- package/dist/providers/video-conferencing/zoom.js +26 -24
- package/dist/providers/video-conferencing/zoom.js.map +1 -1
- package/dist/tools/data.d.ts.map +1 -1
- package/dist/tools/data.js +5 -12
- package/dist/tools/data.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/system.d.ts +289 -0
- package/dist/tools/system.d.ts.map +1 -0
- package/dist/tools/system.js +752 -0
- package/dist/tools/system.js.map +1 -0
- package/dist/tools/web.d.ts.map +1 -1
- package/dist/tools/web.js +22 -10
- package/dist/tools/web.js.map +1 -1
- package/dist/track-record.d.ts +101 -0
- package/dist/track-record.d.ts.map +1 -0
- package/dist/track-record.js +17 -0
- package/dist/track-record.js.map +1 -0
- package/dist/types.d.ts +210 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/verb-registration.d.ts +122 -0
- package/dist/verb-registration.d.ts.map +1 -0
- package/dist/verb-registration.js +176 -0
- package/dist/verb-registration.js.map +1 -0
- package/dist/worker.d.ts +93 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +315 -0
- package/dist/worker.js.map +1 -0
- package/dist/wrap.d.ts +89 -0
- package/dist/wrap.d.ts.map +1 -0
- package/dist/wrap.js +225 -0
- package/dist/wrap.js.map +1 -0
- package/package.json +31 -14
- package/src/client.ts +136 -0
- package/src/define.ts +30 -24
- package/src/function-ref.ts +264 -0
- package/src/function-sugar.ts +134 -0
- package/src/index.ts +132 -10
- package/src/providers/analytics/mixpanel.ts +19 -18
- package/src/providers/calendar/cal-com.ts +29 -18
- package/src/providers/calendar/google-calendar.ts +20 -14
- package/src/providers/crm/hubspot.ts +225 -99
- package/src/providers/development/github.ts +206 -135
- package/src/providers/ecommerce/shopify.ts +250 -89
- package/src/providers/email/resend.ts +101 -28
- package/src/providers/email/sendgrid.ts +12 -9
- package/src/providers/finance/stripe.ts +128 -49
- package/src/providers/forms/typeform.ts +74 -58
- package/src/providers/knowledge/notion.ts +340 -88
- package/src/providers/marketing/mailchimp.ts +86 -70
- package/src/providers/media/cloudinary.ts +99 -41
- package/src/providers/messaging/slack.ts +283 -85
- package/src/providers/messaging/twilio-sms.ts +35 -15
- package/src/providers/project-management/linear.ts +143 -55
- package/src/providers/spreadsheet/google-sheets.ts +222 -56
- package/src/providers/spreadsheet/xlsx.ts +47 -16
- package/src/providers/storage/s3.ts +119 -47
- package/src/providers/support/zendesk.ts +196 -46
- package/src/providers/tasks/todoist.ts +20 -26
- package/src/providers/video-conferencing/google-meet.ts +17 -20
- package/src/providers/video-conferencing/jitsi.ts +14 -14
- package/src/providers/video-conferencing/teams.ts +14 -13
- package/src/providers/video-conferencing/zoom.ts +54 -49
- package/src/tools/data.ts +6 -16
- package/src/tools/index.ts +1 -0
- package/src/tools/system.ts +887 -0
- package/src/tools/web.ts +22 -10
- package/src/track-record.ts +106 -0
- package/src/types.ts +241 -13
- package/src/verb-registration.ts +197 -0
- package/src/worker.ts +370 -0
- package/src/wrap.ts +260 -0
- package/test/client.test.ts +146 -0
- package/test/communication-tools-extended.test.ts +734 -0
- package/test/data-tools-extended.test.ts +743 -0
- package/test/define-extended.test.ts +819 -0
- package/test/define.test.ts +150 -41
- package/test/entities.test.ts +623 -0
- package/test/extended-entities.test.ts +1228 -0
- package/test/provider-implementations.test.ts +725 -0
- package/test/provider-registry-extended.test.ts +583 -0
- package/test/providers/google-sheets.test.ts +851 -0
- package/test/providers/helpers.ts +554 -0
- package/test/providers/hubspot.test.ts +576 -0
- package/test/providers/slack.test.ts +932 -0
- package/test/providers/stripe.test.ts +701 -0
- package/test/providers.test.ts +578 -0
- package/test/system-tools-extended.test.ts +632 -0
- package/test/system.test.ts +673 -0
- package/test/tools.test.ts +15 -11
- package/test/types.test.ts +402 -0
- package/test/verb-registration.test.ts +395 -0
- package/test/web-tools.test.ts +553 -0
- package/test/worker-extended.test.ts +699 -0
- package/test/worker.test.ts +576 -0
- package/test/wrap.test.ts +366 -0
- package/tsconfig.json +3 -13
- package/vitest.config.ts +37 -0
- package/wrangler.jsonc +9 -0
- package/LICENSE +0 -21
- package/dist/providers/voice/vapi.d.ts +0 -27
- package/dist/providers/voice/vapi.d.ts.map +0 -1
- package/dist/providers/voice/vapi.js +0 -440
- package/dist/providers/voice/vapi.js.map +0 -1
- package/src/define.js +0 -259
- package/src/entities/advertising.js +0 -999
- package/src/entities/ai.js +0 -756
- package/src/entities/analytics.js +0 -1588
- package/src/entities/automation.js +0 -601
- package/src/entities/communication.js +0 -1150
- package/src/entities/crm.js +0 -1386
- package/src/entities/design.js +0 -546
- package/src/entities/development.js +0 -2212
- package/src/entities/document.js +0 -874
- package/src/entities/ecommerce.js +0 -1429
- package/src/entities/experiment.js +0 -1039
- package/src/entities/finance.js +0 -3478
- package/src/entities/forms.js +0 -1892
- package/src/entities/hr.js +0 -661
- package/src/entities/identity.js +0 -997
- package/src/entities/index.js +0 -282
- package/src/entities/infrastructure.js +0 -1153
- package/src/entities/knowledge.js +0 -1438
- package/src/entities/marketing.js +0 -1610
- package/src/entities/media.js +0 -1634
- package/src/entities/notification.js +0 -1199
- package/src/entities/presentation.js +0 -1274
- package/src/entities/productivity.js +0 -1317
- package/src/entities/project-management.js +0 -1136
- package/src/entities/recruiting.js +0 -736
- package/src/entities/shipping.js +0 -509
- package/src/entities/signature.js +0 -1102
- package/src/entities/site.js +0 -222
- package/src/entities/spreadsheet.js +0 -1341
- package/src/entities/storage.js +0 -1198
- package/src/entities/support.js +0 -1166
- package/src/entities/video-conferencing.js +0 -1750
- package/src/entities/video.js +0 -950
- package/src/entities.js +0 -1663
- package/src/index.js +0 -74
- package/src/providers/analytics/index.js +0 -17
- package/src/providers/analytics/mixpanel.js +0 -255
- package/src/providers/calendar/cal-com.js +0 -303
- package/src/providers/calendar/google-calendar.js +0 -335
- package/src/providers/calendar/index.js +0 -20
- package/src/providers/crm/hubspot.js +0 -566
- package/src/providers/crm/index.js +0 -17
- package/src/providers/development/github.js +0 -472
- package/src/providers/development/index.js +0 -17
- package/src/providers/ecommerce/index.js +0 -17
- package/src/providers/ecommerce/shopify.js +0 -378
- package/src/providers/email/index.js +0 -20
- package/src/providers/email/resend.js +0 -258
- package/src/providers/email/sendgrid.js +0 -161
- package/src/providers/finance/index.js +0 -17
- package/src/providers/finance/stripe.js +0 -549
- package/src/providers/forms/index.js +0 -17
- package/src/providers/forms/typeform.js +0 -500
- package/src/providers/index.js +0 -123
- package/src/providers/knowledge/index.js +0 -17
- package/src/providers/knowledge/notion.js +0 -389
- package/src/providers/marketing/index.js +0 -17
- package/src/providers/marketing/mailchimp.js +0 -443
- package/src/providers/media/cloudinary.js +0 -318
- package/src/providers/media/index.js +0 -17
- package/src/providers/messaging/index.js +0 -20
- package/src/providers/messaging/slack.js +0 -393
- package/src/providers/messaging/twilio-sms.js +0 -249
- package/src/providers/project-management/index.js +0 -17
- package/src/providers/project-management/linear.js +0 -575
- package/src/providers/registry.js +0 -86
- package/src/providers/spreadsheet/google-sheets.js +0 -375
- package/src/providers/spreadsheet/index.js +0 -20
- package/src/providers/spreadsheet/xlsx.js +0 -423
- package/src/providers/storage/index.js +0 -24
- package/src/providers/storage/s3.js +0 -419
- package/src/providers/support/index.js +0 -17
- package/src/providers/support/zendesk.js +0 -373
- package/src/providers/tasks/index.js +0 -17
- package/src/providers/tasks/todoist.js +0 -286
- package/src/providers/types.js +0 -9
- package/src/providers/video-conferencing/google-meet.js +0 -286
- package/src/providers/video-conferencing/index.js +0 -31
- package/src/providers/video-conferencing/jitsi.js +0 -254
- package/src/providers/video-conferencing/teams.js +0 -270
- package/src/providers/video-conferencing/zoom.js +0 -332
- package/src/registry.js +0 -128
- package/src/tools/communication.js +0 -184
- package/src/tools/data.js +0 -205
- package/src/tools/index.js +0 -11
- package/src/tools/web.js +0 -137
- package/src/types.js +0 -10
- package/test/define.test.js +0 -306
- package/test/registry.test.js +0 -357
- package/test/tools.test.js +0 -363
|
@@ -0,0 +1,734 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extended Tests for Communication Tools
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive tests for sendEmail, sendSlackMessage,
|
|
5
|
+
* sendNotification, and sendSms tools.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { describe, it, expect, beforeEach } from 'vitest'
|
|
9
|
+
import {
|
|
10
|
+
sendEmail,
|
|
11
|
+
sendSlackMessage,
|
|
12
|
+
sendNotification,
|
|
13
|
+
sendSms,
|
|
14
|
+
communicationTools,
|
|
15
|
+
registry,
|
|
16
|
+
registerBuiltinTools,
|
|
17
|
+
} from '../src/index.js'
|
|
18
|
+
|
|
19
|
+
describe('Communication Tools - sendEmail Extended', () => {
|
|
20
|
+
describe('metadata', () => {
|
|
21
|
+
it('has correct id', () => {
|
|
22
|
+
expect(sendEmail.id).toBe('communication.email.send')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('has correct name', () => {
|
|
26
|
+
expect(sendEmail.name).toBe('Send Email')
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('has correct category', () => {
|
|
30
|
+
expect(sendEmail.category).toBe('communication')
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('has correct subcategory', () => {
|
|
34
|
+
expect(sendEmail.subcategory).toBe('email')
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('requires confirmation', () => {
|
|
38
|
+
expect(sendEmail.requiresConfirmation).toBe(true)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('has email permission', () => {
|
|
42
|
+
expect(sendEmail.permissions).toBeDefined()
|
|
43
|
+
expect(sendEmail.permissions?.[0]?.type).toBe('execute')
|
|
44
|
+
expect(sendEmail.permissions?.[0]?.resource).toBe('email')
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('is for both audiences', () => {
|
|
48
|
+
expect(sendEmail.audience).toBe('both')
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('has email tag', () => {
|
|
52
|
+
expect(sendEmail.tags).toContain('email')
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('has send tag', () => {
|
|
56
|
+
expect(sendEmail.tags).toContain('send')
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it('has notify tag', () => {
|
|
60
|
+
expect(sendEmail.tags).toContain('notify')
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
describe('parameters', () => {
|
|
65
|
+
it('has to parameter as required', () => {
|
|
66
|
+
const toParam = sendEmail.parameters.find((p) => p.name === 'to')
|
|
67
|
+
expect(toParam).toBeDefined()
|
|
68
|
+
expect(toParam?.required).toBe(true)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('has subject parameter as required', () => {
|
|
72
|
+
const subjectParam = sendEmail.parameters.find((p) => p.name === 'subject')
|
|
73
|
+
expect(subjectParam).toBeDefined()
|
|
74
|
+
expect(subjectParam?.required).toBe(true)
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
it('has body parameter as required', () => {
|
|
78
|
+
const bodyParam = sendEmail.parameters.find((p) => p.name === 'body')
|
|
79
|
+
expect(bodyParam).toBeDefined()
|
|
80
|
+
expect(bodyParam?.required).toBe(true)
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
it('has cc parameter as optional', () => {
|
|
84
|
+
const ccParam = sendEmail.parameters.find((p) => p.name === 'cc')
|
|
85
|
+
expect(ccParam).toBeDefined()
|
|
86
|
+
expect(ccParam?.required).toBe(false)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it('has bcc parameter as optional', () => {
|
|
90
|
+
const bccParam = sendEmail.parameters.find((p) => p.name === 'bcc')
|
|
91
|
+
expect(bccParam).toBeDefined()
|
|
92
|
+
expect(bccParam?.required).toBe(false)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it('has html parameter as optional', () => {
|
|
96
|
+
const htmlParam = sendEmail.parameters.find((p) => p.name === 'html')
|
|
97
|
+
expect(htmlParam).toBeDefined()
|
|
98
|
+
expect(htmlParam?.required).toBe(false)
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
it('has attachments parameter as optional', () => {
|
|
102
|
+
const attachmentsParam = sendEmail.parameters.find((p) => p.name === 'attachments')
|
|
103
|
+
expect(attachmentsParam).toBeDefined()
|
|
104
|
+
expect(attachmentsParam?.required).toBe(false)
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it('has 7 parameters total', () => {
|
|
108
|
+
expect(sendEmail.parameters).toHaveLength(7)
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
describe('handler', () => {
|
|
113
|
+
it('sends email to single recipient', async () => {
|
|
114
|
+
const result = await sendEmail.handler({
|
|
115
|
+
to: ['test@example.com'],
|
|
116
|
+
subject: 'Test Subject',
|
|
117
|
+
body: 'Test body content',
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
expect(result.success).toBe(true)
|
|
121
|
+
expect(result.messageId).toBeDefined()
|
|
122
|
+
expect(result.messageId).toMatch(/^msg_/)
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
it('sends email to multiple recipients', async () => {
|
|
126
|
+
const result = await sendEmail.handler({
|
|
127
|
+
to: ['a@example.com', 'b@example.com', 'c@example.com'],
|
|
128
|
+
subject: 'Test',
|
|
129
|
+
body: 'Test',
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
expect(result.success).toBe(true)
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
it('sends email with cc recipients', async () => {
|
|
136
|
+
const result = await sendEmail.handler({
|
|
137
|
+
to: ['to@example.com'],
|
|
138
|
+
cc: ['cc@example.com'],
|
|
139
|
+
subject: 'Test',
|
|
140
|
+
body: 'Test',
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
expect(result.success).toBe(true)
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
it('sends email with bcc recipients', async () => {
|
|
147
|
+
const result = await sendEmail.handler({
|
|
148
|
+
to: ['to@example.com'],
|
|
149
|
+
bcc: ['bcc@example.com'],
|
|
150
|
+
subject: 'Test',
|
|
151
|
+
body: 'Test',
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
expect(result.success).toBe(true)
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
it('sends email with html content', async () => {
|
|
158
|
+
const result = await sendEmail.handler({
|
|
159
|
+
to: ['test@example.com'],
|
|
160
|
+
subject: 'HTML Email',
|
|
161
|
+
body: 'Plain text fallback',
|
|
162
|
+
html: '<h1>Hello World</h1>',
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
expect(result.success).toBe(true)
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
it('sends email with attachments', async () => {
|
|
169
|
+
const result = await sendEmail.handler({
|
|
170
|
+
to: ['test@example.com'],
|
|
171
|
+
subject: 'Email with Attachment',
|
|
172
|
+
body: 'See attached file',
|
|
173
|
+
attachments: [
|
|
174
|
+
{
|
|
175
|
+
filename: 'test.txt',
|
|
176
|
+
content: 'SGVsbG8gV29ybGQ=', // base64
|
|
177
|
+
contentType: 'text/plain',
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
expect(result.success).toBe(true)
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
it('generates unique message IDs', async () => {
|
|
186
|
+
const result1 = await sendEmail.handler({
|
|
187
|
+
to: ['a@example.com'],
|
|
188
|
+
subject: 'Test 1',
|
|
189
|
+
body: 'Body 1',
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
const result2 = await sendEmail.handler({
|
|
193
|
+
to: ['b@example.com'],
|
|
194
|
+
subject: 'Test 2',
|
|
195
|
+
body: 'Body 2',
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
expect(result1.messageId).not.toBe(result2.messageId)
|
|
199
|
+
})
|
|
200
|
+
})
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
describe('Communication Tools - sendSlackMessage Extended', () => {
|
|
204
|
+
describe('metadata', () => {
|
|
205
|
+
it('has correct id', () => {
|
|
206
|
+
expect(sendSlackMessage.id).toBe('communication.slack.send')
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
it('has correct name', () => {
|
|
210
|
+
expect(sendSlackMessage.name).toBe('Send Slack Message')
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
it('has correct category', () => {
|
|
214
|
+
expect(sendSlackMessage.category).toBe('communication')
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
it('has correct subcategory', () => {
|
|
218
|
+
expect(sendSlackMessage.subcategory).toBe('slack')
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
it('has slack permission', () => {
|
|
222
|
+
expect(sendSlackMessage.permissions).toBeDefined()
|
|
223
|
+
expect(sendSlackMessage.permissions?.[0]?.resource).toBe('slack')
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
it('has slack tag', () => {
|
|
227
|
+
expect(sendSlackMessage.tags).toContain('slack')
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
it('has message tag', () => {
|
|
231
|
+
expect(sendSlackMessage.tags).toContain('message')
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
it('has chat tag', () => {
|
|
235
|
+
expect(sendSlackMessage.tags).toContain('chat')
|
|
236
|
+
})
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
describe('parameters', () => {
|
|
240
|
+
it('has channel parameter as required', () => {
|
|
241
|
+
const channelParam = sendSlackMessage.parameters.find((p) => p.name === 'channel')
|
|
242
|
+
expect(channelParam).toBeDefined()
|
|
243
|
+
expect(channelParam?.required).toBe(true)
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
it('has text parameter as required', () => {
|
|
247
|
+
const textParam = sendSlackMessage.parameters.find((p) => p.name === 'text')
|
|
248
|
+
expect(textParam).toBeDefined()
|
|
249
|
+
expect(textParam?.required).toBe(true)
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
it('has blocks parameter as optional', () => {
|
|
253
|
+
const blocksParam = sendSlackMessage.parameters.find((p) => p.name === 'blocks')
|
|
254
|
+
expect(blocksParam).toBeDefined()
|
|
255
|
+
expect(blocksParam?.required).toBe(false)
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
it('has threadTs parameter as optional', () => {
|
|
259
|
+
const threadTsParam = sendSlackMessage.parameters.find((p) => p.name === 'threadTs')
|
|
260
|
+
expect(threadTsParam).toBeDefined()
|
|
261
|
+
expect(threadTsParam?.required).toBe(false)
|
|
262
|
+
})
|
|
263
|
+
|
|
264
|
+
it('has unfurlLinks parameter as optional', () => {
|
|
265
|
+
const unfurlParam = sendSlackMessage.parameters.find((p) => p.name === 'unfurlLinks')
|
|
266
|
+
expect(unfurlParam).toBeDefined()
|
|
267
|
+
expect(unfurlParam?.required).toBe(false)
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
it('has 5 parameters total', () => {
|
|
271
|
+
expect(sendSlackMessage.parameters).toHaveLength(5)
|
|
272
|
+
})
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
describe('handler', () => {
|
|
276
|
+
it('sends message to channel', async () => {
|
|
277
|
+
const result = await sendSlackMessage.handler({
|
|
278
|
+
channel: '#general',
|
|
279
|
+
text: 'Hello from test!',
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
expect(result.success).toBe(true)
|
|
283
|
+
expect(result.ts).toBeDefined()
|
|
284
|
+
expect(result.channel).toBe('#general')
|
|
285
|
+
})
|
|
286
|
+
|
|
287
|
+
it('sends message to channel by ID', async () => {
|
|
288
|
+
const result = await sendSlackMessage.handler({
|
|
289
|
+
channel: 'C1234567890',
|
|
290
|
+
text: 'Hello!',
|
|
291
|
+
})
|
|
292
|
+
|
|
293
|
+
expect(result.success).toBe(true)
|
|
294
|
+
expect(result.channel).toBe('C1234567890')
|
|
295
|
+
})
|
|
296
|
+
|
|
297
|
+
it('generates timestamp', async () => {
|
|
298
|
+
const result = await sendSlackMessage.handler({
|
|
299
|
+
channel: '#test',
|
|
300
|
+
text: 'Test message',
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
expect(result.ts).toMatch(/^\d+\.\d+$/)
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
it('sends message with blocks', async () => {
|
|
307
|
+
const result = await sendSlackMessage.handler({
|
|
308
|
+
channel: '#test',
|
|
309
|
+
text: 'Fallback text',
|
|
310
|
+
blocks: [
|
|
311
|
+
{
|
|
312
|
+
type: 'section',
|
|
313
|
+
text: { type: 'mrkdwn', text: 'Hello *world*' },
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
})
|
|
317
|
+
|
|
318
|
+
expect(result.success).toBe(true)
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
it('sends threaded reply', async () => {
|
|
322
|
+
const result = await sendSlackMessage.handler({
|
|
323
|
+
channel: '#test',
|
|
324
|
+
text: 'Reply in thread',
|
|
325
|
+
threadTs: '1234567890.123456',
|
|
326
|
+
})
|
|
327
|
+
|
|
328
|
+
expect(result.success).toBe(true)
|
|
329
|
+
})
|
|
330
|
+
})
|
|
331
|
+
})
|
|
332
|
+
|
|
333
|
+
describe('Communication Tools - sendNotification Extended', () => {
|
|
334
|
+
describe('metadata', () => {
|
|
335
|
+
it('has correct id', () => {
|
|
336
|
+
expect(sendNotification.id).toBe('communication.notify')
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
it('has correct name', () => {
|
|
340
|
+
expect(sendNotification.name).toBe('Send Notification')
|
|
341
|
+
})
|
|
342
|
+
|
|
343
|
+
it('has correct category', () => {
|
|
344
|
+
expect(sendNotification.category).toBe('communication')
|
|
345
|
+
})
|
|
346
|
+
|
|
347
|
+
it('has correct subcategory', () => {
|
|
348
|
+
expect(sendNotification.subcategory).toBe('notification')
|
|
349
|
+
})
|
|
350
|
+
|
|
351
|
+
it('has notify tag', () => {
|
|
352
|
+
expect(sendNotification.tags).toContain('notify')
|
|
353
|
+
})
|
|
354
|
+
|
|
355
|
+
it('has alert tag', () => {
|
|
356
|
+
expect(sendNotification.tags).toContain('alert')
|
|
357
|
+
})
|
|
358
|
+
|
|
359
|
+
it('has message tag', () => {
|
|
360
|
+
expect(sendNotification.tags).toContain('message')
|
|
361
|
+
})
|
|
362
|
+
})
|
|
363
|
+
|
|
364
|
+
describe('parameters', () => {
|
|
365
|
+
it('has channel parameter as required', () => {
|
|
366
|
+
const channelParam = sendNotification.parameters.find((p) => p.name === 'channel')
|
|
367
|
+
expect(channelParam).toBeDefined()
|
|
368
|
+
expect(channelParam?.required).toBe(true)
|
|
369
|
+
})
|
|
370
|
+
|
|
371
|
+
it('has recipients parameter as required', () => {
|
|
372
|
+
const recipientsParam = sendNotification.parameters.find((p) => p.name === 'recipients')
|
|
373
|
+
expect(recipientsParam).toBeDefined()
|
|
374
|
+
expect(recipientsParam?.required).toBe(true)
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
it('has title parameter as required', () => {
|
|
378
|
+
const titleParam = sendNotification.parameters.find((p) => p.name === 'title')
|
|
379
|
+
expect(titleParam).toBeDefined()
|
|
380
|
+
expect(titleParam?.required).toBe(true)
|
|
381
|
+
})
|
|
382
|
+
|
|
383
|
+
it('has message parameter as required', () => {
|
|
384
|
+
const messageParam = sendNotification.parameters.find((p) => p.name === 'message')
|
|
385
|
+
expect(messageParam).toBeDefined()
|
|
386
|
+
expect(messageParam?.required).toBe(true)
|
|
387
|
+
})
|
|
388
|
+
|
|
389
|
+
it('has priority parameter as optional', () => {
|
|
390
|
+
const priorityParam = sendNotification.parameters.find((p) => p.name === 'priority')
|
|
391
|
+
expect(priorityParam).toBeDefined()
|
|
392
|
+
expect(priorityParam?.required).toBe(false)
|
|
393
|
+
})
|
|
394
|
+
|
|
395
|
+
it('has data parameter as optional', () => {
|
|
396
|
+
const dataParam = sendNotification.parameters.find((p) => p.name === 'data')
|
|
397
|
+
expect(dataParam).toBeDefined()
|
|
398
|
+
expect(dataParam?.required).toBe(false)
|
|
399
|
+
})
|
|
400
|
+
|
|
401
|
+
it('has 6 parameters total', () => {
|
|
402
|
+
expect(sendNotification.parameters).toHaveLength(6)
|
|
403
|
+
})
|
|
404
|
+
})
|
|
405
|
+
|
|
406
|
+
describe('handler', () => {
|
|
407
|
+
it('sends email notification', async () => {
|
|
408
|
+
const result = await sendNotification.handler({
|
|
409
|
+
channel: 'email',
|
|
410
|
+
recipients: ['user@example.com'],
|
|
411
|
+
title: 'Test Alert',
|
|
412
|
+
message: 'This is a test notification',
|
|
413
|
+
})
|
|
414
|
+
|
|
415
|
+
expect(result.success).toBe(true)
|
|
416
|
+
expect(result.notificationId).toMatch(/^notif_/)
|
|
417
|
+
expect(result.delivered).toContain('user@example.com')
|
|
418
|
+
})
|
|
419
|
+
|
|
420
|
+
it('sends slack notification', async () => {
|
|
421
|
+
const result = await sendNotification.handler({
|
|
422
|
+
channel: 'slack',
|
|
423
|
+
recipients: ['#general'],
|
|
424
|
+
title: 'Alert',
|
|
425
|
+
message: 'Important update',
|
|
426
|
+
})
|
|
427
|
+
|
|
428
|
+
expect(result.success).toBe(true)
|
|
429
|
+
})
|
|
430
|
+
|
|
431
|
+
it('sends sms notification', async () => {
|
|
432
|
+
const result = await sendNotification.handler({
|
|
433
|
+
channel: 'sms',
|
|
434
|
+
recipients: ['+15551234567'],
|
|
435
|
+
title: 'Alert',
|
|
436
|
+
message: 'SMS notification',
|
|
437
|
+
})
|
|
438
|
+
|
|
439
|
+
expect(result.success).toBe(true)
|
|
440
|
+
})
|
|
441
|
+
|
|
442
|
+
it('sends push notification', async () => {
|
|
443
|
+
const result = await sendNotification.handler({
|
|
444
|
+
channel: 'push',
|
|
445
|
+
recipients: ['device-token-123'],
|
|
446
|
+
title: 'Push Alert',
|
|
447
|
+
message: 'Push notification message',
|
|
448
|
+
})
|
|
449
|
+
|
|
450
|
+
expect(result.success).toBe(true)
|
|
451
|
+
})
|
|
452
|
+
|
|
453
|
+
it('sends webhook notification', async () => {
|
|
454
|
+
const result = await sendNotification.handler({
|
|
455
|
+
channel: 'webhook',
|
|
456
|
+
recipients: ['https://example.com/webhook'],
|
|
457
|
+
title: 'Webhook Event',
|
|
458
|
+
message: 'Data payload',
|
|
459
|
+
})
|
|
460
|
+
|
|
461
|
+
expect(result.success).toBe(true)
|
|
462
|
+
})
|
|
463
|
+
|
|
464
|
+
it('sends to multiple recipients', async () => {
|
|
465
|
+
const recipients = ['a@example.com', 'b@example.com', 'c@example.com']
|
|
466
|
+
const result = await sendNotification.handler({
|
|
467
|
+
channel: 'email',
|
|
468
|
+
recipients,
|
|
469
|
+
title: 'Bulk Alert',
|
|
470
|
+
message: 'Message to many',
|
|
471
|
+
})
|
|
472
|
+
|
|
473
|
+
expect(result.success).toBe(true)
|
|
474
|
+
expect(result.delivered).toEqual(recipients)
|
|
475
|
+
})
|
|
476
|
+
|
|
477
|
+
it('handles high priority', async () => {
|
|
478
|
+
const result = await sendNotification.handler({
|
|
479
|
+
channel: 'email',
|
|
480
|
+
recipients: ['user@example.com'],
|
|
481
|
+
title: 'Urgent',
|
|
482
|
+
message: 'High priority message',
|
|
483
|
+
priority: 'high',
|
|
484
|
+
})
|
|
485
|
+
|
|
486
|
+
expect(result.success).toBe(true)
|
|
487
|
+
})
|
|
488
|
+
|
|
489
|
+
it('handles urgent priority', async () => {
|
|
490
|
+
const result = await sendNotification.handler({
|
|
491
|
+
channel: 'sms',
|
|
492
|
+
recipients: ['+15551234567'],
|
|
493
|
+
title: 'Emergency',
|
|
494
|
+
message: 'Urgent message',
|
|
495
|
+
priority: 'urgent',
|
|
496
|
+
})
|
|
497
|
+
|
|
498
|
+
expect(result.success).toBe(true)
|
|
499
|
+
})
|
|
500
|
+
|
|
501
|
+
it('includes additional data', async () => {
|
|
502
|
+
const result = await sendNotification.handler({
|
|
503
|
+
channel: 'webhook',
|
|
504
|
+
recipients: ['https://example.com/hook'],
|
|
505
|
+
title: 'Event',
|
|
506
|
+
message: 'Custom data attached',
|
|
507
|
+
data: { userId: 123, action: 'test' },
|
|
508
|
+
})
|
|
509
|
+
|
|
510
|
+
expect(result.success).toBe(true)
|
|
511
|
+
})
|
|
512
|
+
|
|
513
|
+
it('generates notification IDs with correct format', async () => {
|
|
514
|
+
const result1 = await sendNotification.handler({
|
|
515
|
+
channel: 'email',
|
|
516
|
+
recipients: ['a@example.com'],
|
|
517
|
+
title: 'Test 1',
|
|
518
|
+
message: 'Message 1',
|
|
519
|
+
})
|
|
520
|
+
|
|
521
|
+
// Small delay to ensure different timestamps
|
|
522
|
+
await new Promise((resolve) => setTimeout(resolve, 1))
|
|
523
|
+
|
|
524
|
+
const result2 = await sendNotification.handler({
|
|
525
|
+
channel: 'email',
|
|
526
|
+
recipients: ['b@example.com'],
|
|
527
|
+
title: 'Test 2',
|
|
528
|
+
message: 'Message 2',
|
|
529
|
+
})
|
|
530
|
+
|
|
531
|
+
expect(result1.notificationId).toMatch(/^notif_\d+$/)
|
|
532
|
+
expect(result2.notificationId).toMatch(/^notif_\d+$/)
|
|
533
|
+
})
|
|
534
|
+
})
|
|
535
|
+
})
|
|
536
|
+
|
|
537
|
+
describe('Communication Tools - sendSms Extended', () => {
|
|
538
|
+
describe('metadata', () => {
|
|
539
|
+
it('has correct id', () => {
|
|
540
|
+
expect(sendSms.id).toBe('communication.sms.send')
|
|
541
|
+
})
|
|
542
|
+
|
|
543
|
+
it('has correct name', () => {
|
|
544
|
+
expect(sendSms.name).toBe('Send SMS')
|
|
545
|
+
})
|
|
546
|
+
|
|
547
|
+
it('has correct category', () => {
|
|
548
|
+
expect(sendSms.category).toBe('communication')
|
|
549
|
+
})
|
|
550
|
+
|
|
551
|
+
it('has correct subcategory', () => {
|
|
552
|
+
expect(sendSms.subcategory).toBe('sms')
|
|
553
|
+
})
|
|
554
|
+
|
|
555
|
+
it('requires confirmation', () => {
|
|
556
|
+
expect(sendSms.requiresConfirmation).toBe(true)
|
|
557
|
+
})
|
|
558
|
+
|
|
559
|
+
it('has sms permission', () => {
|
|
560
|
+
expect(sendSms.permissions).toBeDefined()
|
|
561
|
+
expect(sendSms.permissions?.[0]?.resource).toBe('sms')
|
|
562
|
+
})
|
|
563
|
+
|
|
564
|
+
it('has sms tag', () => {
|
|
565
|
+
expect(sendSms.tags).toContain('sms')
|
|
566
|
+
})
|
|
567
|
+
|
|
568
|
+
it('has text tag', () => {
|
|
569
|
+
expect(sendSms.tags).toContain('text')
|
|
570
|
+
})
|
|
571
|
+
|
|
572
|
+
it('has mobile tag', () => {
|
|
573
|
+
expect(sendSms.tags).toContain('mobile')
|
|
574
|
+
})
|
|
575
|
+
})
|
|
576
|
+
|
|
577
|
+
describe('parameters', () => {
|
|
578
|
+
it('has to parameter as required', () => {
|
|
579
|
+
const toParam = sendSms.parameters.find((p) => p.name === 'to')
|
|
580
|
+
expect(toParam).toBeDefined()
|
|
581
|
+
expect(toParam?.required).toBe(true)
|
|
582
|
+
})
|
|
583
|
+
|
|
584
|
+
it('has message parameter as required', () => {
|
|
585
|
+
const messageParam = sendSms.parameters.find((p) => p.name === 'message')
|
|
586
|
+
expect(messageParam).toBeDefined()
|
|
587
|
+
expect(messageParam?.required).toBe(true)
|
|
588
|
+
})
|
|
589
|
+
|
|
590
|
+
it('has from parameter as optional', () => {
|
|
591
|
+
const fromParam = sendSms.parameters.find((p) => p.name === 'from')
|
|
592
|
+
expect(fromParam).toBeDefined()
|
|
593
|
+
expect(fromParam?.required).toBe(false)
|
|
594
|
+
})
|
|
595
|
+
|
|
596
|
+
it('has 3 parameters total', () => {
|
|
597
|
+
expect(sendSms.parameters).toHaveLength(3)
|
|
598
|
+
})
|
|
599
|
+
})
|
|
600
|
+
|
|
601
|
+
describe('handler', () => {
|
|
602
|
+
it('sends sms to phone number', async () => {
|
|
603
|
+
const result = await sendSms.handler({
|
|
604
|
+
to: '+15551234567',
|
|
605
|
+
message: 'Hello via SMS!',
|
|
606
|
+
})
|
|
607
|
+
|
|
608
|
+
expect(result.success).toBe(true)
|
|
609
|
+
expect(result.messageId).toBeDefined()
|
|
610
|
+
expect(result.messageId).toMatch(/^sms_/)
|
|
611
|
+
})
|
|
612
|
+
|
|
613
|
+
it('sends sms with from number', async () => {
|
|
614
|
+
const result = await sendSms.handler({
|
|
615
|
+
to: '+15551234567',
|
|
616
|
+
message: 'Test message',
|
|
617
|
+
from: '+15559876543',
|
|
618
|
+
})
|
|
619
|
+
|
|
620
|
+
expect(result.success).toBe(true)
|
|
621
|
+
})
|
|
622
|
+
|
|
623
|
+
it('handles short messages', async () => {
|
|
624
|
+
const result = await sendSms.handler({
|
|
625
|
+
to: '+15551234567',
|
|
626
|
+
message: 'Hi',
|
|
627
|
+
})
|
|
628
|
+
|
|
629
|
+
expect(result.success).toBe(true)
|
|
630
|
+
})
|
|
631
|
+
|
|
632
|
+
it('handles max length messages', async () => {
|
|
633
|
+
const longMessage = 'A'.repeat(160)
|
|
634
|
+
const result = await sendSms.handler({
|
|
635
|
+
to: '+15551234567',
|
|
636
|
+
message: longMessage,
|
|
637
|
+
})
|
|
638
|
+
|
|
639
|
+
expect(result.success).toBe(true)
|
|
640
|
+
})
|
|
641
|
+
|
|
642
|
+
it('generates message IDs with correct format', async () => {
|
|
643
|
+
const result1 = await sendSms.handler({
|
|
644
|
+
to: '+15551111111',
|
|
645
|
+
message: 'Message 1',
|
|
646
|
+
})
|
|
647
|
+
|
|
648
|
+
// Small delay to ensure different timestamps
|
|
649
|
+
await new Promise((resolve) => setTimeout(resolve, 1))
|
|
650
|
+
|
|
651
|
+
const result2 = await sendSms.handler({
|
|
652
|
+
to: '+15552222222',
|
|
653
|
+
message: 'Message 2',
|
|
654
|
+
})
|
|
655
|
+
|
|
656
|
+
expect(result1.messageId).toMatch(/^sms_\d+$/)
|
|
657
|
+
expect(result2.messageId).toMatch(/^sms_\d+$/)
|
|
658
|
+
})
|
|
659
|
+
})
|
|
660
|
+
})
|
|
661
|
+
|
|
662
|
+
describe('Communication Tools Array', () => {
|
|
663
|
+
it('has 4 tools', () => {
|
|
664
|
+
expect(communicationTools).toHaveLength(4)
|
|
665
|
+
})
|
|
666
|
+
|
|
667
|
+
it('contains sendEmail', () => {
|
|
668
|
+
expect(communicationTools.map((t) => t.id)).toContain('communication.email.send')
|
|
669
|
+
})
|
|
670
|
+
|
|
671
|
+
it('contains sendSlackMessage', () => {
|
|
672
|
+
expect(communicationTools.map((t) => t.id)).toContain('communication.slack.send')
|
|
673
|
+
})
|
|
674
|
+
|
|
675
|
+
it('contains sendNotification', () => {
|
|
676
|
+
expect(communicationTools.map((t) => t.id)).toContain('communication.notify')
|
|
677
|
+
})
|
|
678
|
+
|
|
679
|
+
it('contains sendSms', () => {
|
|
680
|
+
expect(communicationTools.map((t) => t.id)).toContain('communication.sms.send')
|
|
681
|
+
})
|
|
682
|
+
|
|
683
|
+
it('all tools are in communication category', () => {
|
|
684
|
+
expect(communicationTools.every((t) => t.category === 'communication')).toBe(true)
|
|
685
|
+
})
|
|
686
|
+
|
|
687
|
+
it('all tools are for both audiences', () => {
|
|
688
|
+
expect(communicationTools.every((t) => t.audience === 'both')).toBe(true)
|
|
689
|
+
})
|
|
690
|
+
})
|
|
691
|
+
|
|
692
|
+
describe('Communication Tools Registry Integration', () => {
|
|
693
|
+
beforeEach(() => {
|
|
694
|
+
registry.clear()
|
|
695
|
+
})
|
|
696
|
+
|
|
697
|
+
it('registers all communication tools', () => {
|
|
698
|
+
registerBuiltinTools()
|
|
699
|
+
|
|
700
|
+
expect(registry.has('communication.email.send')).toBe(true)
|
|
701
|
+
expect(registry.has('communication.slack.send')).toBe(true)
|
|
702
|
+
expect(registry.has('communication.notify')).toBe(true)
|
|
703
|
+
expect(registry.has('communication.sms.send')).toBe(true)
|
|
704
|
+
})
|
|
705
|
+
|
|
706
|
+
it('can query by communication category', () => {
|
|
707
|
+
registerBuiltinTools()
|
|
708
|
+
|
|
709
|
+
const tools = registry.byCategory('communication')
|
|
710
|
+
expect(tools.length).toBeGreaterThanOrEqual(4)
|
|
711
|
+
})
|
|
712
|
+
|
|
713
|
+
it('can query by email subcategory', () => {
|
|
714
|
+
registerBuiltinTools()
|
|
715
|
+
|
|
716
|
+
const tools = registry.query({ subcategory: 'email' })
|
|
717
|
+
expect(tools.some((t) => t.id === 'communication.email.send')).toBe(true)
|
|
718
|
+
})
|
|
719
|
+
|
|
720
|
+
it('can query by sms subcategory', () => {
|
|
721
|
+
registerBuiltinTools()
|
|
722
|
+
|
|
723
|
+
const tools = registry.query({ subcategory: 'sms' })
|
|
724
|
+
expect(tools.some((t) => t.id === 'communication.sms.send')).toBe(true)
|
|
725
|
+
})
|
|
726
|
+
|
|
727
|
+
it('can search by notify tag', () => {
|
|
728
|
+
registerBuiltinTools()
|
|
729
|
+
|
|
730
|
+
const tools = registry.query({ tags: ['notify'] })
|
|
731
|
+
expect(tools.some((t) => t.id === 'communication.email.send')).toBe(true)
|
|
732
|
+
expect(tools.some((t) => t.id === 'communication.notify')).toBe(true)
|
|
733
|
+
})
|
|
734
|
+
})
|