miaw-core 0.9.0 → 1.1.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/CHANGELOG.md +167 -0
- package/README.md +132 -11
- package/babel.config.js +2 -2
- package/dist/client/MiawClient.d.ts +111 -9
- package/dist/client/MiawClient.d.ts.map +1 -1
- package/dist/client/MiawClient.js +1136 -546
- package/dist/client/MiawClient.js.map +1 -1
- package/dist/handlers/AuthHandler.d.ts +5 -0
- package/dist/handlers/AuthHandler.d.ts.map +1 -1
- package/dist/handlers/AuthHandler.js +21 -10
- package/dist/handlers/AuthHandler.js.map +1 -1
- package/dist/handlers/MessageHandler.d.ts +1 -1
- package/dist/handlers/MessageHandler.d.ts.map +1 -1
- package/dist/handlers/MessageHandler.js +21 -25
- package/dist/handlers/MessageHandler.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -7
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +129 -24
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +4 -7
- package/dist/types/index.js.map +1 -1
- package/docs/API_STABILITY_REVIEW.md +316 -0
- package/docs/BAILEYS_MIGRATION_v7.md +220 -0
- package/docs/BAILEYS_VS_MIAW_COMPARISON.md +522 -0
- package/docs/MIGRATION.md +307 -0
- package/docs/TEST_COVERAGE_ANALYSIS.md +256 -0
- package/{USAGE.md → docs/USAGE.md} +68 -11
- package/eslint.config.js +22 -0
- package/package.json +23 -6
- package/tsconfig.json +6 -5
- package/tsconfig.test.json +3 -1
- package/dist/utils/storage.d.ts +0 -25
- package/dist/utils/storage.d.ts.map +0 -1
- package/dist/utils/storage.js +0 -60
- package/dist/utils/storage.js.map +0 -1
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# Migration Guide
|
|
2
|
+
|
|
3
|
+
This guide helps you migrate between versions of Miaw Core.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [v1.0.x to v1.1.0](#v10x-to-v110)
|
|
8
|
+
- [v0.9.x to v1.0.0](#v09x-to-v100)
|
|
9
|
+
- [v0.8.x to v0.9.0](#v08x-to-v090)
|
|
10
|
+
- [v0.7.x to v0.8.0](#v07x-to-v080)
|
|
11
|
+
- [Breaking Changes Summary](#breaking-changes-summary)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## v1.0.x to v1.1.0
|
|
16
|
+
|
|
17
|
+
**Status:** Stable Release (2026-01-02)
|
|
18
|
+
|
|
19
|
+
v1.1.0 upgrades to Baileys v7.0.0-rc.9 and migrates to ESM-only. This fixes the session reconnection issue where the app couldn't reconnect after QR scan and restart.
|
|
20
|
+
|
|
21
|
+
### Breaking Changes
|
|
22
|
+
|
|
23
|
+
#### ESM-Only Package
|
|
24
|
+
|
|
25
|
+
Miaw Core is now ESM-only. CommonJS `require()` is no longer supported.
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
// ❌ Before (CommonJS - no longer works)
|
|
29
|
+
const { MiawClient } = require("miaw-core");
|
|
30
|
+
|
|
31
|
+
// ✅ After (ESM)
|
|
32
|
+
import { MiawClient } from "miaw-core";
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
#### Node.js Version
|
|
36
|
+
|
|
37
|
+
Node.js >= 18.0.0 is now required.
|
|
38
|
+
|
|
39
|
+
### Migration Steps
|
|
40
|
+
|
|
41
|
+
1. **Update your package.json:**
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"type": "module"
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Or rename your files from `.js` to `.mjs`.
|
|
50
|
+
|
|
51
|
+
2. **Update imports to ESM syntax:**
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// Change require() to import
|
|
55
|
+
import { MiawClient } from "miaw-core";
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
3. **Update dependencies:**
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install miaw-core@latest
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
4. **Check Node.js version:**
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
node -v # Must be >= 18.0.0
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
5. **Delete old sessions (recommended):**
|
|
71
|
+
```bash
|
|
72
|
+
rm -rf ./sessions
|
|
73
|
+
```
|
|
74
|
+
Re-pair with QR code to get fresh session with Baileys v7.
|
|
75
|
+
|
|
76
|
+
### What's Fixed
|
|
77
|
+
|
|
78
|
+
- Session persistence after QR scan - apps can now restart and reconnect without re-pairing
|
|
79
|
+
- Improved Signal key store transaction safety
|
|
80
|
+
- Better pre-key synchronization
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## v0.9.x to v1.0.0
|
|
85
|
+
|
|
86
|
+
**Status:** Stable Release (2025-12-24)
|
|
87
|
+
|
|
88
|
+
v1.0.0 is the first stable release. While we aim for no breaking changes, here are the important changes to note:
|
|
89
|
+
|
|
90
|
+
### New Features
|
|
91
|
+
|
|
92
|
+
#### Resource Cleanup
|
|
93
|
+
|
|
94
|
+
New `dispose()` method for proper cleanup:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// Before (v0.9.x)
|
|
98
|
+
// No explicit cleanup needed
|
|
99
|
+
|
|
100
|
+
// After (v1.0.0)
|
|
101
|
+
await client.dispose(); // Clean up resources
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### LID Cache Management
|
|
105
|
+
|
|
106
|
+
New methods for managing LID to JID mapping cache:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
// Get cache size
|
|
110
|
+
const size = client.getLidCacheSize();
|
|
111
|
+
|
|
112
|
+
// Clear cache
|
|
113
|
+
client.clearLidCache();
|
|
114
|
+
|
|
115
|
+
// Get all mappings
|
|
116
|
+
const mappings = client.getLidMappings(); // Returns Record<string, string>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Performance Improvements
|
|
120
|
+
|
|
121
|
+
- LID mappings now use LRU cache with max size of 1000 entries
|
|
122
|
+
- Automatic eviction of least recently used mappings
|
|
123
|
+
- Improved memory management for long-running bots
|
|
124
|
+
|
|
125
|
+
### Migration Steps
|
|
126
|
+
|
|
127
|
+
1. **Update dependencies:**
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npm install miaw-core@latest
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
2. **Add cleanup on shutdown (recommended):**
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
process.on("SIGINT", async () => {
|
|
137
|
+
await client.dispose();
|
|
138
|
+
process.exit(0);
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
3. **Test your bot thoroughly** - v1.0.0 has stability guarantees
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## v0.8.x to v0.9.0
|
|
147
|
+
|
|
148
|
+
### Label Operations (WhatsApp Business)
|
|
149
|
+
|
|
150
|
+
New methods for managing labels:
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
// Create or edit a label
|
|
154
|
+
await client.addLabel({
|
|
155
|
+
name: "VIP Customers",
|
|
156
|
+
color: LabelColor.Color1,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// Add label to chat
|
|
160
|
+
await client.addChatLabel(chatJid, labelId);
|
|
161
|
+
|
|
162
|
+
// Add label to message
|
|
163
|
+
await client.addMessageLabel(messageId, chatJid, labelId);
|
|
164
|
+
|
|
165
|
+
// Remove labels
|
|
166
|
+
await client.removeChatLabel(chatJid, labelId);
|
|
167
|
+
await client.removeMessageLabel(messageId, chatJid, labelId);
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Catalog/Product Operations (WhatsApp Business)
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
// Get product catalog
|
|
174
|
+
const catalog = await client.getCatalog(businessJid);
|
|
175
|
+
|
|
176
|
+
// Create product
|
|
177
|
+
await client.createProduct({
|
|
178
|
+
name: "Product Name",
|
|
179
|
+
price: 1999, // in cents
|
|
180
|
+
description: "Description",
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// Update product
|
|
184
|
+
await client.updateProduct(productId, { name: "New Name" });
|
|
185
|
+
|
|
186
|
+
// Delete products
|
|
187
|
+
await client.deleteProducts([productId1, productId2]);
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Newsletter/Channel Operations
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
// Create newsletter
|
|
194
|
+
const result = await client.createNewsletter("My Channel");
|
|
195
|
+
|
|
196
|
+
// Follow/unfollow
|
|
197
|
+
await client.followNewsletter(newsletterId);
|
|
198
|
+
await client.unfollowNewsletter(newsletterId);
|
|
199
|
+
|
|
200
|
+
// Update newsletter
|
|
201
|
+
await client.updateNewsletterName(newsletterId, "New Name");
|
|
202
|
+
await client.updateNewsletterDescription(newsletterId, "New Description");
|
|
203
|
+
await client.updateNewsletterPicture(newsletterId, { url: "..." });
|
|
204
|
+
|
|
205
|
+
// Get messages
|
|
206
|
+
const messages = await client.fetchNewsletterMessages(newsletterId);
|
|
207
|
+
|
|
208
|
+
// React to posts
|
|
209
|
+
await client.reactToNewsletterMessage(newsletterId, messageId, "👍");
|
|
210
|
+
|
|
211
|
+
// Newsletter management
|
|
212
|
+
await client.getNewsletterSubscribers(newsletterId);
|
|
213
|
+
await client.changeNewsletterOwner(newsletterId, newOwnerId);
|
|
214
|
+
await client.deleteNewsletter(newsletterId);
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Contact Management
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
// Add or edit contact
|
|
221
|
+
await client.addOrEditContact({
|
|
222
|
+
phone: "6281234567890",
|
|
223
|
+
name: "John Doe",
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// Remove contact
|
|
227
|
+
await client.removeContact("6281234567890");
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## v0.7.x to v0.8.0
|
|
233
|
+
|
|
234
|
+
### Profile Management
|
|
235
|
+
|
|
236
|
+
New profile management methods:
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
// Update profile picture (file path, URL, or Buffer)
|
|
240
|
+
await client.updateProfilePicture({ path: "./profile.jpg" });
|
|
241
|
+
await client.updateProfilePicture({ url: "https://..." });
|
|
242
|
+
await client.updateProfilePicture({ buffer: imageBuffer });
|
|
243
|
+
|
|
244
|
+
// Remove profile picture
|
|
245
|
+
await client.removeProfilePicture();
|
|
246
|
+
|
|
247
|
+
// Update profile name
|
|
248
|
+
await client.updateProfileName("My Bot Name");
|
|
249
|
+
|
|
250
|
+
// Update profile status (About)
|
|
251
|
+
await client.updateProfileStatus("Available for chats");
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Breaking Changes Summary
|
|
257
|
+
|
|
258
|
+
| Version | Change | Migration Required |
|
|
259
|
+
| ------- | ------------------------------------------------ | ------------------ |
|
|
260
|
+
| v1.0.0 | New `dispose()` method | Recommended |
|
|
261
|
+
| v1.0.0 | `getLidMappings()` returns object instead of Map | Yes, if using |
|
|
262
|
+
| v0.9.0 | Label operations added | No (new features) |
|
|
263
|
+
| v0.9.0 | Catalog operations added | No (new features) |
|
|
264
|
+
| v0.9.0 | Newsletter operations added | No (new features) |
|
|
265
|
+
| v0.9.0 | Contact operations added | No (new features) |
|
|
266
|
+
| v0.8.0 | Profile management added | No (new features) |
|
|
267
|
+
| v0.7.0 | Group management added | No (new features) |
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Upgrading Best Practices
|
|
272
|
+
|
|
273
|
+
1. **Read the changelog** - Always check `CHANGELOG.md` for detailed changes
|
|
274
|
+
2. **Test in development** - Test your bot thoroughly before deploying to production
|
|
275
|
+
3. **Backup sessions** - Keep a backup of your `sessions/` directory
|
|
276
|
+
4. **Update gradually** - Don't skip versions when possible
|
|
277
|
+
5. **Check examples** - Look at `examples/` for updated usage patterns
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Getting Help
|
|
282
|
+
|
|
283
|
+
If you encounter issues during migration:
|
|
284
|
+
|
|
285
|
+
1. Check the [USAGE.md](./USAGE.md) for detailed documentation
|
|
286
|
+
2. Review [examples/](./examples/) for sample implementations
|
|
287
|
+
3. Open an issue on GitHub with:
|
|
288
|
+
- Your current version
|
|
289
|
+
- Target version
|
|
290
|
+
- Error messages
|
|
291
|
+
- Code snippets
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Version Compatibility
|
|
296
|
+
|
|
297
|
+
| Miaw Core | Node.js | Baileys | Status |
|
|
298
|
+
| --------- | -------- | ------- | -------------------- |
|
|
299
|
+
| 1.0.0 | >=18.0.0 | 6.7.21+ | Stable (Coming Soon) |
|
|
300
|
+
| 0.9.x | >=18.0.0 | 6.7.21+ | Stable |
|
|
301
|
+
| 0.8.x | >=18.0.0 | 6.7.21+ | Stable |
|
|
302
|
+
| 0.7.x | >=18.0.0 | 6.7.21+ | Stable |
|
|
303
|
+
| < 0.7 | >=18.0.0 | 6.7.21+ | Upgraded recommended |
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
**Last Updated:** 2025-12-24
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# MiawClient Test Coverage Analysis
|
|
2
|
+
|
|
3
|
+
**Generated:** January 2, 2026
|
|
4
|
+
**Source Files Analyzed:**
|
|
5
|
+
|
|
6
|
+
- `src/client/MiawClient.ts` - Main client implementation
|
|
7
|
+
- `tests/interactive-test.ts` - Interactive manual test suite
|
|
8
|
+
|
|
9
|
+
## Summary
|
|
10
|
+
|
|
11
|
+
| Category | Total Methods | Covered | Coverage |
|
|
12
|
+
| ------------------ | ------------- | ------- | -------- |
|
|
13
|
+
| Core Client | 6 | 5 | 83% |
|
|
14
|
+
| Basic GET Ops | 6 | 6 | 100% |
|
|
15
|
+
| Messaging | 12 | 11 | 92% |
|
|
16
|
+
| Contact/Validation | 5 | 5 | 100% |
|
|
17
|
+
| Group Management | 16 | 13 | 81% |
|
|
18
|
+
| Profile Management | 4 | 4 | 100% |
|
|
19
|
+
| Business - Labels | 5 | 4 | 80% |
|
|
20
|
+
| Business - Catalog | 5 | 5 | 100% |
|
|
21
|
+
| Newsletter/Channel | 21 | 6 | 29% |
|
|
22
|
+
| Contact Management | 2 | 2 | 100% |
|
|
23
|
+
| UX Features | 5 | 5 | 100% |
|
|
24
|
+
| LID/JID Utilities | 5 | 0 | 0% |
|
|
25
|
+
| **TOTAL** | **92** | **66** | **72%** |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Detailed Coverage Table
|
|
30
|
+
|
|
31
|
+
### Core Client (83% covered)
|
|
32
|
+
|
|
33
|
+
| Method | Line | Interactive Test | Test Category | Status |
|
|
34
|
+
| ---------------------- | ---- | --------------------------------------------- | ------------- | -------------- |
|
|
35
|
+
| `constructor()` | - | "Constructor - Create client" | Core Client | ✅ Covered |
|
|
36
|
+
| `connect()` | 173 | "connect() - Connect to WhatsApp" | Core Client | ✅ Covered |
|
|
37
|
+
| `dispose()` | 641 | - | - | ❌ Not Covered |
|
|
38
|
+
| `disconnect()` | 4040 | "disconnect() - Disconnect from WhatsApp" | Final | ✅ Covered |
|
|
39
|
+
| `getConnectionState()` | 4058 | "getConnectionState() - Get connection state" | Core Client | ✅ Covered |
|
|
40
|
+
| `getInstanceId()` | 4065 | "getInstanceId() - Get instance ID" | Core Client | ✅ Covered |
|
|
41
|
+
| `isConnected()` | 4072 | "isConnected() - Check if connected" | Core Client | ✅ Covered |
|
|
42
|
+
|
|
43
|
+
### Basic GET Operations (100% covered)
|
|
44
|
+
|
|
45
|
+
| Method | Line | Interactive Test | Test Category | Status |
|
|
46
|
+
| -------------------- | ---- | ------------------------------------------ | ------------- | ---------- |
|
|
47
|
+
| `getOwnProfile()` | 1336 | "getOwnProfile() - Get your profile" | Basic GET Ops | ✅ Covered |
|
|
48
|
+
| `fetchAllContacts()` | 1263 | "fetchAllContacts() - Get all contacts" | Basic GET Ops | ✅ Covered |
|
|
49
|
+
| `fetchAllGroups()` | 1284 | "fetchAllGroups() - Get all groups" | Basic GET Ops | ✅ Covered |
|
|
50
|
+
| `fetchAllChats()` | 1483 | "fetchAllChats() - Get all chats" | Basic GET Ops | ✅ Covered |
|
|
51
|
+
| `getChatMessages()` | 1460 | "getChatMessages(jid) - Get chat messages" | Basic GET Ops | ✅ Covered |
|
|
52
|
+
| `fetchAllLabels()` | 1430 | "fetchAllLabels() - Get all labels" | Business | ✅ Covered |
|
|
53
|
+
|
|
54
|
+
### Messaging (92% covered)
|
|
55
|
+
|
|
56
|
+
| Method | Line | Interactive Test | Test Category | Status |
|
|
57
|
+
| ---------------------- | ---- | --------------------------------------- | ------------- | -------------- |
|
|
58
|
+
| `sendText()` | 723 | "sendText() - Send text message" | Messaging | ✅ Covered |
|
|
59
|
+
| `sendImage()` | 767 | "sendImage() - Send image" | Messaging | ✅ Covered |
|
|
60
|
+
| `sendDocument()` | 822 | "sendDocument() - Send document" | Messaging | ⚠️ Skipped |
|
|
61
|
+
| `sendVideo()` | 892 | "sendVideo() - Send video" | Messaging | ⚠️ Skipped |
|
|
62
|
+
| `sendAudio()` | 949 | "sendAudio() - Send audio" | Messaging | ⚠️ Skipped |
|
|
63
|
+
| `downloadMedia()` | 1009 | "downloadMedia() - Download media" | Messaging | ✅ Covered |
|
|
64
|
+
| `sendReaction()` | 1579 | "sendReaction() - Send reaction" | Messaging | ✅ Covered |
|
|
65
|
+
| `removeReaction()` | 1630 | "removeReaction() - Remove reaction" | Messaging | ✅ Covered |
|
|
66
|
+
| `forwardMessage()` | 1640 | "forwardMessage() - Forward message" | Messaging | ✅ Covered |
|
|
67
|
+
| `editMessage()` | 1686 | "editMessage() - Edit message" | Messaging | ✅ Covered |
|
|
68
|
+
| `deleteMessage()` | 1739 | "deleteMessage() - Delete for everyone" | Messaging | ✅ Covered |
|
|
69
|
+
| `deleteMessageForMe()` | 1785 | - | - | ❌ Not Covered |
|
|
70
|
+
|
|
71
|
+
### Contact & Validation (100% covered)
|
|
72
|
+
|
|
73
|
+
| Method | Line | Interactive Test | Test Category | Status |
|
|
74
|
+
| ---------------------- | ---- | --------------------------------------------- | ------------- | ---------- |
|
|
75
|
+
| `checkNumber()` | 1054 | "checkNumber() - Check if number on WhatsApp" | Contacts | ✅ Covered |
|
|
76
|
+
| `checkNumbers()` | 1090 | "checkNumbers() - Batch check numbers" | Contacts | ✅ Covered |
|
|
77
|
+
| `getContactInfo()` | 1125 | "getContactInfo() - Get contact info" | Contacts | ✅ Covered |
|
|
78
|
+
| `getBusinessProfile()` | 1183 | "getBusinessProfile() - Get business profile" | Contacts | ✅ Covered |
|
|
79
|
+
| `getProfilePicture()` | 1225 | "getProfilePicture() - Get profile picture" | Contacts | ✅ Covered |
|
|
80
|
+
|
|
81
|
+
### Group Management (81% covered)
|
|
82
|
+
|
|
83
|
+
| Method | Line | Interactive Test | Test Category | Status |
|
|
84
|
+
| -------------------------- | ---- | ----------------------------------------------------- | ------------- | -------------- |
|
|
85
|
+
| `getGroupInfo()` | 1509 | "getGroupInfo() - Get group metadata" | Group Mgmt | ✅ Covered |
|
|
86
|
+
| `getGroupParticipants()` | 1562 | "getGroupParticipants() - Get group members" | Group Mgmt | ✅ Covered |
|
|
87
|
+
| `createGroup()` | 2027 | "createGroup() - Create new group" | Group Mgmt | ✅ Covered |
|
|
88
|
+
| `addParticipants()` | 2094 | "addParticipants() - Add members to group" | Group Mgmt | ✅ Covered |
|
|
89
|
+
| `removeParticipants()` | 2120 | "removeParticipants() - Remove members (DESTRUCTIVE)" | Group Mgmt | ✅ Covered |
|
|
90
|
+
| `leaveGroup()` | 2145 | "leaveGroup() - Leave group (DESTRUCTIVE)" | Group Mgmt | ✅ Covered |
|
|
91
|
+
| `promoteToAdmin()` | 2179 | "promoteToAdmin() - Promote member to admin" | Group Mgmt | ✅ Covered |
|
|
92
|
+
| `demoteFromAdmin()` | 2205 | "demoteFromAdmin() - Demote admin" | Group Mgmt | ✅ Covered |
|
|
93
|
+
| `updateGroupName()` | 2231 | "updateGroupName() - Change group name" | Group Mgmt | ✅ Covered |
|
|
94
|
+
| `updateGroupDescription()` | 2268 | "updateGroupDescription() - Set group description" | Group Mgmt | ✅ Covered |
|
|
95
|
+
| `updateGroupPicture()` | 2305 | "updateGroupPicture() - Change group picture" | Group Mgmt | ⚠️ Skipped |
|
|
96
|
+
| `getGroupInviteLink()` | 2342 | "getGroupInviteLink() - Get invite link" | Group Mgmt | ✅ Covered |
|
|
97
|
+
| `revokeGroupInvite()` | 2371 | - | - | ❌ Not Covered |
|
|
98
|
+
| `acceptGroupInvite()` | 2400 | "acceptGroupInvite() - Join via invite" | Group Mgmt | ✅ Covered |
|
|
99
|
+
| `getGroupInviteInfo()` | 2431 | - | - | ❌ Not Covered |
|
|
100
|
+
|
|
101
|
+
### Profile Management (100% covered)
|
|
102
|
+
|
|
103
|
+
| Method | Line | Interactive Test | Test Category | Status |
|
|
104
|
+
| ------------------------ | ---- | --------------------------------------------------------------- | ------------- | ---------- |
|
|
105
|
+
| `updateProfilePicture()` | 2475 | "updateProfilePicture() - Update own profile picture" | Profile Mgmt | ⚠️ Skipped |
|
|
106
|
+
| `removeProfilePicture()` | 2511 | "removeProfilePicture() - Remove profile picture (DESTRUCTIVE)" | Profile Mgmt | ✅ Covered |
|
|
107
|
+
| `updateProfileName()` | 2545 | "updateProfileName() - Update display name" | Profile Mgmt | ✅ Covered |
|
|
108
|
+
| `updateProfileStatus()` | 2578 | "updateProfileStatus() - Update About text" | Profile Mgmt | ✅ Covered |
|
|
109
|
+
|
|
110
|
+
### Business - Labels (80% covered)
|
|
111
|
+
|
|
112
|
+
| Method | Line | Interactive Test | Test Category | Status |
|
|
113
|
+
| ---------------------- | ---- | -------------------------------------------- | ------------- | -------------- |
|
|
114
|
+
| `addLabel()` | 2612 | "addLabel() - Create new label" | Business | ✅ Covered |
|
|
115
|
+
| `addChatLabel()` | 2676 | "addChatLabel() - Add label to chat" | Business | ✅ Covered |
|
|
116
|
+
| `removeChatLabel()` | 2711 | "removeChatLabel() - Remove label from chat" | Business | ✅ Covered |
|
|
117
|
+
| `addMessageLabel()` | 2747 | "addMessageLabel() - Add label to message" | Business | ⚠️ Skipped |
|
|
118
|
+
| `removeMessageLabel()` | 2784 | - | - | ❌ Not Covered |
|
|
119
|
+
|
|
120
|
+
### Business - Catalog (100% covered)
|
|
121
|
+
|
|
122
|
+
| Method | Line | Interactive Test | Test Category | Status |
|
|
123
|
+
| ------------------ | ---- | ---------------------------------------------- | ------------- | ---------- |
|
|
124
|
+
| `getCatalog()` | 2825 | "getCatalog() - Fetch product catalog" | Business | ✅ Covered |
|
|
125
|
+
| `getCollections()` | 2887 | "getCollections() - Get catalog collections" | Business | ✅ Covered |
|
|
126
|
+
| `createProduct()` | 2935 | "createProduct() - Add new product" | Business | ✅ Covered |
|
|
127
|
+
| `updateProduct()` | 3002 | "updateProduct() - Modify product" | Business | ✅ Covered |
|
|
128
|
+
| `deleteProducts()` | 3068 | "deleteProducts() - Remove products (CLEANUP)" | Business | ✅ Covered |
|
|
129
|
+
|
|
130
|
+
### Newsletter/Channel (29% covered)
|
|
131
|
+
|
|
132
|
+
| Method | Line | Interactive Test | Test Category | Status |
|
|
133
|
+
| ------------------------------- | ---- | ------------------------------------------------ | ------------- | -------------- |
|
|
134
|
+
| `sendNewsletterMessage()` | 3110 | "sendNewsletterMessage() - Send text to channel" | Newsletter | ✅ Covered |
|
|
135
|
+
| `sendNewsletterImage()` | 3153 | "sendNewsletterImage() - Send image to channel" | Newsletter | ✅ Covered |
|
|
136
|
+
| `sendNewsletterVideo()` | 3200 | - | - | ❌ Not Covered |
|
|
137
|
+
| `createNewsletter()` | 3245 | "createNewsletter() - Create newsletter/channel" | Newsletter | ✅ Covered |
|
|
138
|
+
| `getNewsletterMetadata()` | 3330 | "getNewsletterMetadata() - Get newsletter info" | Newsletter | ✅ Covered |
|
|
139
|
+
| `followNewsletter()` | 3381 | "followNewsletter() - Follow/subscribe" | Newsletter | ✅ Covered |
|
|
140
|
+
| `unfollowNewsletter()` | 3410 | - | - | ❌ Not Covered |
|
|
141
|
+
| `muteNewsletter()` | 3439 | - | - | ❌ Not Covered |
|
|
142
|
+
| `unmuteNewsletter()` | 3468 | - | - | ❌ Not Covered |
|
|
143
|
+
| `updateNewsletterName()` | 3498 | - | - | ❌ Not Covered |
|
|
144
|
+
| `updateNewsletterDescription()` | 3531 | - | - | ❌ Not Covered |
|
|
145
|
+
| `updateNewsletterPicture()` | 3564 | - | - | ❌ Not Covered |
|
|
146
|
+
| `removeNewsletterPicture()` | 3597 | - | - | ❌ Not Covered |
|
|
147
|
+
| `reactToNewsletterMessage()` | 3628 | - | - | ❌ Not Covered |
|
|
148
|
+
| `fetchNewsletterMessages()` | 3664 | - | - | ❌ Not Covered |
|
|
149
|
+
| `subscribeNewsletterUpdates()` | 3725 | - | - | ❌ Not Covered |
|
|
150
|
+
| `getNewsletterSubscribers()` | 3754 | - | - | ❌ Not Covered |
|
|
151
|
+
| `getNewsletterAdminCount()` | 3789 | - | - | ❌ Not Covered |
|
|
152
|
+
| `changeNewsletterOwner()` | 3819 | - | - | ❌ Not Covered |
|
|
153
|
+
| `demoteNewsletterAdmin()` | 3853 | - | - | ❌ Not Covered |
|
|
154
|
+
| `deleteNewsletter()` | 3886 | "deleteNewsletter() - Delete newsletter" | Newsletter | ✅ Covered |
|
|
155
|
+
|
|
156
|
+
### Contact Management (100% covered)
|
|
157
|
+
|
|
158
|
+
| Method | Line | Interactive Test | Test Category | Status |
|
|
159
|
+
| -------------------- | ---- | -------------------------------------------- | ------------- | ---------- |
|
|
160
|
+
| `addOrEditContact()` | 3919 | "addOrEditContact() - Add or update contact" | Contacts | ✅ Covered |
|
|
161
|
+
| `removeContact()` | 3965 | "removeContact() - Remove contact" | Contacts | ✅ Covered |
|
|
162
|
+
|
|
163
|
+
### UX Features (100% covered)
|
|
164
|
+
|
|
165
|
+
| Method | Line | Interactive Test | Test Category | Status |
|
|
166
|
+
| --------------------- | ---- | ----------------------------------------------------- | ------------- | ------------------------------------------ |
|
|
167
|
+
| `markAsRead()` | 1838 | "markAsRead() - Mark message as read" | UX Features | ✅ Covered |
|
|
168
|
+
| `sendTyping()` | 1866 | "sendTyping() - Send typing indicator" | UX Features | ✅ Covered |
|
|
169
|
+
| `sendRecording()` | 1889 | "sendRecording() - Send recording indicator" | UX Features | ✅ Covered |
|
|
170
|
+
| `stopTyping()` | 1912 | - | - | ❌ Not Covered (but tested via sendTyping) |
|
|
171
|
+
| `setPresence()` | 1935 | "setPresence() - Set online/offline status" | UX Features | ✅ Covered |
|
|
172
|
+
| `subscribePresence()` | 1958 | "subscribePresence() - Subscribe to presence updates" | UX Features | ✅ Covered |
|
|
173
|
+
|
|
174
|
+
### LID/JID Utility Methods (0% covered - internal use)
|
|
175
|
+
|
|
176
|
+
| Method | Line | Interactive Test | Test Category | Status |
|
|
177
|
+
| ---------------------- | ---- | ---------------- | ------------- | -------------- |
|
|
178
|
+
| `resolveLidToJid()` | 567 | - | - | ❌ Not Covered |
|
|
179
|
+
| `getPhoneFromJid()` | 579 | - | - | ❌ Not Covered |
|
|
180
|
+
| `registerLidMapping()` | 593 | - | - | ❌ Not Covered |
|
|
181
|
+
| `getLidMappings()` | 605 | - | - | ❌ Not Covered |
|
|
182
|
+
| `getLidCacheSize()` | 617 | - | - | ❌ Not Covered |
|
|
183
|
+
| `clearLidCache()` | 624 | - | - | ❌ Not Covered |
|
|
184
|
+
| `clearSession()` | 634 | - | - | ❌ Not Covered |
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Legend
|
|
189
|
+
|
|
190
|
+
| Status | Description |
|
|
191
|
+
| -------------- | --------------------------------------------------------------- |
|
|
192
|
+
| ✅ Covered | Method has a dedicated test in interactive-test.ts |
|
|
193
|
+
| ⚠️ Skipped | Test exists but auto-skips (requires manual assets/interaction) |
|
|
194
|
+
| ❌ Not Covered | No test exists for this method |
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Recommendations
|
|
199
|
+
|
|
200
|
+
### High Priority (Core Functionality)
|
|
201
|
+
|
|
202
|
+
1. **`deleteMessageForMe()`** - Important messaging feature, no test
|
|
203
|
+
2. **`dispose()`** - Resource cleanup, should be tested
|
|
204
|
+
3. **`stopTyping()`** - Related to sendTyping but never explicitly tested
|
|
205
|
+
|
|
206
|
+
### Medium Priority (Group & Newsletter)
|
|
207
|
+
|
|
208
|
+
4. **`revokeGroupInvite()`** - Paired with getGroupInviteLink
|
|
209
|
+
5. **`getGroupInviteInfo()`** - Preview before joining
|
|
210
|
+
6. **Newsletter methods** (15 uncovered) - Low coverage at 29%:
|
|
211
|
+
- `sendNewsletterVideo()`
|
|
212
|
+
- `unfollowNewsletter()`
|
|
213
|
+
- `muteNewsletter()` / `unmuteNewsletter()`
|
|
214
|
+
- `updateNewsletterName()` / `updateNewsletterDescription()`
|
|
215
|
+
- `updateNewsletterPicture()` / `removeNewsletterPicture()`
|
|
216
|
+
- `reactToNewsletterMessage()`
|
|
217
|
+
- `fetchNewsletterMessages()`
|
|
218
|
+
- `subscribeNewsletterUpdates()`
|
|
219
|
+
- `getNewsletterSubscribers()` / `getNewsletterAdminCount()`
|
|
220
|
+
- `changeNewsletterOwner()` / `demoteNewsletterAdmin()`
|
|
221
|
+
|
|
222
|
+
### Low Priority (Labels & Utilities)
|
|
223
|
+
|
|
224
|
+
7. **`removeMessageLabel()`** - Paired with addMessageLabel
|
|
225
|
+
8. **LID/JID utilities** - Internal use, can be covered by unit tests
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Test Categories Summary
|
|
230
|
+
|
|
231
|
+
| Test Category | Tests Count | Methods Covered |
|
|
232
|
+
| ------------- | ----------- | --------------- |
|
|
233
|
+
| Prerequisites | 1 | 0 (setup only) |
|
|
234
|
+
| Core Client | 5 | 5 |
|
|
235
|
+
| Basic GET Ops | 5 | 6 |
|
|
236
|
+
| Messaging | 11 | 11 |
|
|
237
|
+
| Contacts | 7 | 7 |
|
|
238
|
+
| Group Mgmt | 13 | 13 |
|
|
239
|
+
| Profile Mgmt | 4 | 4 |
|
|
240
|
+
| Business | 10 | 9 |
|
|
241
|
+
| Newsletter | 6 | 6 |
|
|
242
|
+
| UX Features | 5 | 5 |
|
|
243
|
+
| Final | 1 | 1 |
|
|
244
|
+
| **TOTAL** | **68** | **66** |
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Conclusion
|
|
249
|
+
|
|
250
|
+
The interactive test suite provides **72% coverage** of MiawClient's public API. The main gap is in **Newsletter/Channel features** (29% coverage), with 15 methods lacking tests. Core functionality (messaging, contacts, groups, profile) has excellent coverage at 80-100%.
|
|
251
|
+
|
|
252
|
+
For production readiness, consider:
|
|
253
|
+
|
|
254
|
+
1. Adding tests for uncovered newsletter methods
|
|
255
|
+
2. Adding unit tests for LID/JID utility methods
|
|
256
|
+
3. Converting skipped tests (sendDocument, sendVideo, sendAudio) to use test fixtures
|