mailisk 2.1.1 → 2.2.1

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.
Files changed (154) hide show
  1. package/README.md +63 -11
  2. package/dist/index.d.ts +122 -9
  3. package/dist/index.js +33 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +33 -2
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +2 -2
  8. package/private/dist/private/index.js +28 -0
  9. package/private/dist/private/index.js.map +1 -0
  10. package/private/dist/src/mailisk.interfaces.js +3 -0
  11. package/private/dist/src/mailisk.interfaces.js.map +1 -0
  12. package/private/dist/src/mailisk.js +168 -0
  13. package/private/dist/src/mailisk.js.map +1 -0
  14. package/private/index.ts +17 -0
  15. package/private/node_modules/.package-lock.json +44 -0
  16. package/private/node_modules/typescript/LICENSE.txt +55 -0
  17. package/private/node_modules/typescript/README.md +50 -0
  18. package/private/node_modules/typescript/SECURITY.md +41 -0
  19. package/private/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  20. package/private/node_modules/typescript/bin/tsc +2 -0
  21. package/private/node_modules/typescript/bin/tsserver +2 -0
  22. package/private/node_modules/typescript/lib/_tsc.js +133818 -0
  23. package/private/node_modules/typescript/lib/_tsserver.js +659 -0
  24. package/private/node_modules/typescript/lib/_typingsInstaller.js +222 -0
  25. package/private/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
  26. package/private/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
  27. package/private/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
  28. package/private/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
  29. package/private/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
  30. package/private/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
  31. package/private/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
  32. package/private/node_modules/typescript/lib/lib.d.ts +22 -0
  33. package/private/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
  34. package/private/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
  35. package/private/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
  36. package/private/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
  37. package/private/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
  38. package/private/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
  39. package/private/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
  40. package/private/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
  41. package/private/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
  42. package/private/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
  43. package/private/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
  44. package/private/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
  45. package/private/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
  46. package/private/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
  47. package/private/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
  48. package/private/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
  49. package/private/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
  50. package/private/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
  51. package/private/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
  52. package/private/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
  53. package/private/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
  54. package/private/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  55. package/private/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
  56. package/private/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
  57. package/private/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
  58. package/private/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
  59. package/private/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
  60. package/private/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
  61. package/private/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
  62. package/private/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
  63. package/private/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
  64. package/private/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
  65. package/private/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
  66. package/private/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
  67. package/private/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
  68. package/private/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
  69. package/private/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
  70. package/private/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
  71. package/private/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
  72. package/private/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
  73. package/private/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
  74. package/private/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
  75. package/private/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
  76. package/private/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
  77. package/private/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
  78. package/private/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
  79. package/private/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
  80. package/private/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
  81. package/private/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
  82. package/private/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
  83. package/private/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
  84. package/private/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
  85. package/private/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
  86. package/private/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
  87. package/private/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
  88. package/private/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
  89. package/private/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
  90. package/private/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
  91. package/private/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
  92. package/private/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
  93. package/private/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
  94. package/private/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
  95. package/private/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
  96. package/private/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
  97. package/private/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
  98. package/private/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
  99. package/private/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
  100. package/private/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  101. package/private/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
  102. package/private/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
  103. package/private/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
  104. package/private/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
  105. package/private/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
  106. package/private/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
  107. package/private/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
  108. package/private/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
  109. package/private/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
  110. package/private/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
  111. package/private/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
  112. package/private/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
  113. package/private/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
  114. package/private/node_modules/typescript/lib/lib.es6.d.ts +23 -0
  115. package/private/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
  116. package/private/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
  117. package/private/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
  118. package/private/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  119. package/private/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
  120. package/private/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
  121. package/private/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
  122. package/private/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
  123. package/private/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
  124. package/private/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
  125. package/private/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
  126. package/private/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
  127. package/private/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
  128. package/private/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
  129. package/private/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
  130. package/private/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
  131. package/private/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
  132. package/private/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
  133. package/private/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
  134. package/private/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
  135. package/private/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
  136. package/private/node_modules/typescript/lib/tsc.js +8 -0
  137. package/private/node_modules/typescript/lib/tsserver.js +8 -0
  138. package/private/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  139. package/private/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  140. package/private/node_modules/typescript/lib/typesMap.json +497 -0
  141. package/private/node_modules/typescript/lib/typescript.d.ts +11437 -0
  142. package/private/node_modules/typescript/lib/typescript.js +200276 -0
  143. package/private/node_modules/typescript/lib/typingsInstaller.js +8 -0
  144. package/private/node_modules/typescript/lib/watchGuard.js +53 -0
  145. package/private/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
  146. package/private/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
  147. package/private/node_modules/typescript/package.json +120 -0
  148. package/private/package-lock.json +53 -0
  149. package/private/package.json +17 -0
  150. package/private/tsconfig.json +103 -0
  151. package/src/mailisk.interfaces.ts +91 -6
  152. package/src/mailisk.ts +89 -7
  153. package/tests/mocks/axios-mocks.ts +85 -26
  154. package/tests/unit/mailisk.test.ts +138 -2
@@ -1,9 +1,10 @@
1
1
  // Mock namespace response data
2
2
  export const mockNamespacesResponse = {
3
- namespaces: [
3
+ total_count: 1,
4
+ data: [
4
5
  {
5
- name: "test-namespace",
6
- created_at: new Date().toISOString(),
6
+ id: "0fde5afa-a8a8-41a4-9ca4-21d83efc37d8",
7
+ namespace: "test-namespace",
7
8
  expires_at: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString(),
8
9
  },
9
10
  ],
@@ -11,39 +12,97 @@ export const mockNamespacesResponse = {
11
12
 
12
13
  // Mock email response data
13
14
  export const mockEmailsResponse = {
14
- emails: [
15
+ total_count: 1,
16
+ options: {
17
+ wait: true,
18
+ },
19
+ data: [
15
20
  {
16
- id: "email-123",
17
- from: { address: "sender@example.com", name: "Sender" },
18
- to: [{ address: "recipient@test-namespace.mailisk.net", name: "Recipient" }],
19
- subject: "Test Email",
20
- html: "<p>Test content</p>",
21
- text: "Test content",
22
- received_date: new Date().toISOString(),
23
- received_timestamp: Math.floor(Date.now() / 1000),
24
- expires_timestamp: Math.floor(Date.now() / 1000) + 30 * 24 * 60 * 60,
21
+ id: "1763808382384-m-m-dEmYI7ic5",
22
+ from: {
23
+ address: "sender@example.com",
24
+ name: "Sender",
25
+ },
26
+ to: [
27
+ {
28
+ address: "recipient@test-namespace.mailisk.net",
29
+ name: "Recipient",
30
+ },
31
+ ],
32
+ subject: "test",
33
+ html: "false",
34
+ text: "test",
35
+ received_date: "2025-11-22T10:46:22.000Z",
36
+ received_timestamp: 1763808382,
37
+ expires_timestamp: 1764672382,
38
+ spam_score: null,
25
39
  },
26
40
  ],
27
- count: 1,
28
41
  };
29
42
 
30
43
  // Mock attachment response data
31
44
  export const mockAttachmentResponse = {
32
- id: "attachment-123",
33
- filename: "test.txt",
34
- content_type: "text/plain",
35
- size: 100,
36
- expires_at: "Fri, 23 Jun 2025 02:29:13 GMT",
37
- download_url: "https://example.com/attachment-123.txt",
45
+ data: {
46
+ id: "b04730be-9c13-4f23-a2b7-a4a9a943cd31",
47
+ filename: "Sample.png",
48
+ content_type: "image/png",
49
+ size: 140551,
50
+ expires_at: "2025-09-09T10:03:33.000Z",
51
+ download_url: "url",
52
+ },
38
53
  };
39
54
 
40
55
  // Mock SMTP settings response
41
56
  export const mockSmtpSettingsResponse = {
42
- host: "smtp.mailisk.com",
43
- port: 25,
44
- secure: false,
45
- auth: {
46
- user: "test-namespace",
47
- pass: "mock-password",
57
+ data: {
58
+ host: "smtp.mailisk.net",
59
+ port: 587,
60
+ username: "test-namespace",
61
+ password: "mock-password",
62
+ },
63
+ };
64
+
65
+ // Mock SMS messages response data
66
+ export const mockSmsMessagesResponse = {
67
+ total_count: 1,
68
+ options: {
69
+ limit: 20,
70
+ offset: 0,
48
71
  },
72
+ data: [
73
+ {
74
+ id: "37a2bc57-c2c7-4c08-a9dc-d143bc17643f",
75
+ sms_phone_number_id: "ba548be2-bff9-4e3f-a54b-e034c415e906",
76
+ body: "test newline \\n\\n test2",
77
+ from_number: "+18777804236",
78
+ to_number: "+19285639871",
79
+ provider_message_id: "SMf72eb72b6281a02e60a0114f38e34e36",
80
+ created_at: "2020-11-24T16:48:22.170Z",
81
+ direction: "inbound",
82
+ },
83
+ ],
84
+ };
85
+
86
+ // Mock SMS numbers response data
87
+ export const mockSmsNumbersResponse = {
88
+ total_count: 2,
89
+ data: [
90
+ {
91
+ id: "13c4551e-a5be-4959-9ea5-82931dcfc74d",
92
+ organisation_id: "c02bdb84-22df-4c18-85ba-2defdd04eccb",
93
+ status: "requested",
94
+ country: "US",
95
+ created_at: "2020-11-22T16:59:25.462Z",
96
+ updated_at: "2020-11-22T16:59:25.462Z",
97
+ },
98
+ {
99
+ id: "6bf073d6-d333-45c9-b009-c77f0cac7657",
100
+ organisation_id: "ddec2c7b-b087-45b6-a81d-b195f25d457f",
101
+ status: "active",
102
+ country: "US",
103
+ phone_number: "+19285639871",
104
+ created_at: "2020-11-22T16:41:40.329Z",
105
+ updated_at: "2020-11-22T16:41:40.329Z",
106
+ },
107
+ ],
49
108
  };
@@ -9,6 +9,8 @@ import {
9
9
  mockEmailsResponse,
10
10
  mockSmtpSettingsResponse,
11
11
  mockAttachmentResponse,
12
+ mockSmsMessagesResponse,
13
+ mockSmsNumbersResponse,
12
14
  } from "../mocks/axios-mocks";
13
15
 
14
16
  const setupMockAxios = () => {
@@ -132,7 +134,7 @@ describe("MailiskClient", () => {
132
134
  describe("downloadAttachment", () => {
133
135
  it("should download and return attachment data", async () => {
134
136
  const getAttachmentSpy = jest.spyOn(MailiskClient.prototype, "getAttachment");
135
- getAttachmentSpy.mockResolvedValueOnce({ data: mockAttachmentResponse });
137
+ getAttachmentSpy.mockResolvedValueOnce(mockAttachmentResponse);
136
138
 
137
139
  const mockBuffer = Buffer.from("test content");
138
140
  (axios.get as jest.Mock).mockResolvedValueOnce({ data: mockBuffer });
@@ -140,11 +142,145 @@ describe("MailiskClient", () => {
140
142
  const client = new MailiskClient({ apiKey: "test-key" });
141
143
  const result = await client.downloadAttachment("attachment-123");
142
144
 
143
- expect(axios.get).toHaveBeenCalledWith(mockAttachmentResponse.download_url, { responseType: "arraybuffer" });
145
+ expect(axios.get).toHaveBeenCalledWith(mockAttachmentResponse.data.download_url, { responseType: "arraybuffer" });
144
146
  expect(result).toEqual(mockBuffer);
145
147
  });
146
148
  });
147
149
 
150
+ describe("searchSmsMessages", () => {
151
+ it("should fetch and return SMS messages with default parameters", async () => {
152
+ const { mockGet } = setupMockAxios();
153
+ mockGet.mockResolvedValueOnce({ data: mockSmsMessagesResponse });
154
+
155
+ const client = new MailiskClient({ apiKey: "test-key" });
156
+ const result = await client.searchSmsMessages("1234567890");
157
+
158
+ expect(mockGet).toHaveBeenCalledWith("api/sms/1234567890/messages", {
159
+ maxRedirects: 99999,
160
+ timeout: 1000 * 60 * 5,
161
+ params: {
162
+ from_date: expect.any(String),
163
+ wait: true,
164
+ },
165
+ });
166
+
167
+ expect(result).toEqual(mockSmsMessagesResponse);
168
+ });
169
+
170
+ it("should use custom parameters if provided", async () => {
171
+ const { mockGet } = setupMockAxios();
172
+ mockGet.mockResolvedValueOnce({ data: mockSmsMessagesResponse });
173
+
174
+ const customParams = {
175
+ limit: 5,
176
+ offset: 2,
177
+ body: "verification",
178
+ from_number: "+18005550123",
179
+ from_date: "2023-01-01T00:00:00.000Z",
180
+ to_date: "2023-02-01T00:00:00.000Z",
181
+ wait: false,
182
+ };
183
+
184
+ const client = new MailiskClient({ apiKey: "test-key" });
185
+ const result = await client.searchSmsMessages("+1234567890", customParams);
186
+
187
+ const expectedParams = { ...customParams };
188
+
189
+ expect(mockGet).toHaveBeenCalledWith("api/sms/+1234567890/messages", {
190
+ maxRedirects: 99999,
191
+ params: expectedParams,
192
+ });
193
+
194
+ expect(result).toEqual(mockSmsMessagesResponse);
195
+ });
196
+
197
+ it("should use custom axios config if provided", async () => {
198
+ const { mockGet } = setupMockAxios();
199
+ mockGet.mockResolvedValueOnce({ data: mockSmsMessagesResponse });
200
+
201
+ const customConfig = {
202
+ timeout: 10000,
203
+ maxRedirects: 5,
204
+ };
205
+
206
+ const client = new MailiskClient({ apiKey: "test-key" });
207
+ const result = await client.searchSmsMessages("+1234567890", undefined, customConfig);
208
+
209
+ expect(mockGet).toHaveBeenCalledWith("api/sms/+1234567890/messages", {
210
+ ...customConfig,
211
+ params: {
212
+ from_date: expect.any(String),
213
+ wait: true,
214
+ },
215
+ });
216
+
217
+ expect(result).toEqual(mockSmsMessagesResponse);
218
+ });
219
+
220
+ it("should handle errors correctly", async () => {
221
+ const { mockGet } = setupMockAxios();
222
+ const error = new Error("Search SMS Error");
223
+ mockGet.mockRejectedValueOnce(error);
224
+
225
+ const client = new MailiskClient({ apiKey: "test-key" });
226
+
227
+ await expect(client.searchSmsMessages("+1234567890")).rejects.toThrow("Search SMS Error");
228
+ });
229
+ });
230
+
231
+ describe("listSmsNumbers", () => {
232
+ it("should fetch and return SMS numbers", async () => {
233
+ const { mockGet } = setupMockAxios();
234
+ mockGet.mockResolvedValueOnce({ data: mockSmsNumbersResponse });
235
+
236
+ const client = new MailiskClient({ apiKey: "test-key" });
237
+ const result = await client.listSmsNumbers();
238
+
239
+ expect(mockGet).toHaveBeenCalledWith("api/sms/numbers");
240
+ expect(result).toEqual(mockSmsNumbersResponse);
241
+ });
242
+
243
+ it("should handle errors correctly", async () => {
244
+ const { mockGet } = setupMockAxios();
245
+ const error = new Error("List SMS Numbers Error");
246
+ mockGet.mockRejectedValueOnce(error);
247
+
248
+ const client = new MailiskClient({ apiKey: "test-key" });
249
+
250
+ await expect(client.listSmsNumbers()).rejects.toThrow("List SMS Numbers Error");
251
+ });
252
+ });
253
+
254
+ describe("sendVirtualSms", () => {
255
+ it("should send an SMS through the API", async () => {
256
+ const { mockPost } = setupMockAxios();
257
+ mockPost.mockResolvedValueOnce({ data: {} });
258
+
259
+ const smsParams = {
260
+ from_number: "15551234567",
261
+ to_number: "15557654321",
262
+ body: "Test message",
263
+ };
264
+
265
+ const client = new MailiskClient({ apiKey: "test-key" });
266
+ await client.sendVirtualSms(smsParams);
267
+
268
+ expect(mockPost).toHaveBeenCalledWith("api/sms/virtual", smsParams);
269
+ });
270
+
271
+ it("should handle errors when sending SMS", async () => {
272
+ const { mockPost } = setupMockAxios();
273
+ const error = new Error("Send SMS Error");
274
+ mockPost.mockRejectedValueOnce(error);
275
+
276
+ const client = new MailiskClient({ apiKey: "test-key" });
277
+
278
+ await expect(
279
+ client.sendVirtualSms({ from_number: "+15551234567", to_number: "+15557654321", body: "Test message" })
280
+ ).rejects.toThrow("Send SMS Error");
281
+ });
282
+ });
283
+
148
284
  describe("searchInbox", () => {
149
285
  it("should fetch and return emails with default parameters", async () => {
150
286
  const { mockGet } = setupMockAxios();