@cometchat/skills 4.1.0 → 4.2.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/bin/install.js +298 -41
- package/package.json +1 -1
- package/skills/cometchat/SKILL.md +146 -27
- package/skills/cometchat-a11y/SKILL.md +476 -0
- package/skills/cometchat-android-v5/SKILL.md +1 -1
- package/skills/cometchat-android-v5-calls/SKILL.md +413 -0
- package/skills/cometchat-android-v5-calls/references/README.md +53 -0
- package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +195 -0
- package/skills/cometchat-android-v5-calls/references/audio-controls.md +91 -0
- package/skills/cometchat-android-v5-calls/references/background-handling.md +168 -0
- package/skills/cometchat-android-v5-calls/references/call-layouts.md +123 -0
- package/skills/cometchat-android-v5-calls/references/call-logs.md +113 -0
- package/skills/cometchat-android-v5-calls/references/call-session.md +274 -0
- package/skills/cometchat-android-v5-calls/references/custom-ui.md +150 -0
- package/skills/cometchat-android-v5-calls/references/event-listeners.md +123 -0
- package/skills/cometchat-android-v5-calls/references/group-calls.md +205 -0
- package/skills/cometchat-android-v5-calls/references/idle-timeout.md +111 -0
- package/skills/cometchat-android-v5-calls/references/in-call-chat.md +134 -0
- package/skills/cometchat-android-v5-calls/references/join-session.md +120 -0
- package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +206 -0
- package/skills/cometchat-android-v5-calls/references/participant-management.md +110 -0
- package/skills/cometchat-android-v5-calls/references/picture-in-picture.md +106 -0
- package/skills/cometchat-android-v5-calls/references/raise-hand.md +242 -0
- package/skills/cometchat-android-v5-calls/references/recording.md +101 -0
- package/skills/cometchat-android-v5-calls/references/ringing-integration.md +152 -0
- package/skills/cometchat-android-v5-calls/references/screen-sharing.md +82 -0
- package/skills/cometchat-android-v5-calls/references/server-fcm-voip.md +215 -0
- package/skills/cometchat-android-v5-calls/references/session-settings.md +121 -0
- package/skills/cometchat-android-v5-calls/references/setup.md +137 -0
- package/skills/cometchat-android-v5-calls/references/share-invite.md +151 -0
- package/skills/cometchat-android-v5-calls/references/video-controls.md +87 -0
- package/skills/cometchat-android-v5-calls/references/voip-calling.md +526 -0
- package/skills/cometchat-android-v5-components/SKILL.md +1 -1
- package/skills/cometchat-android-v5-core/SKILL.md +1 -1
- package/skills/cometchat-android-v5-customization/SKILL.md +1 -1
- package/skills/cometchat-android-v5-extensions/SKILL.md +1 -1
- package/skills/cometchat-android-v5-features/SKILL.md +1 -1
- package/skills/cometchat-android-v5-placement/SKILL.md +1 -1
- package/skills/cometchat-android-v5-production/SKILL.md +1 -1
- package/skills/cometchat-android-v5-push/SKILL.md +1 -1
- package/skills/cometchat-android-v5-testing/SKILL.md +1 -1
- package/skills/cometchat-android-v5-theming/SKILL.md +1 -1
- package/skills/cometchat-android-v5-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-android-v6/SKILL.md +1 -1
- package/skills/cometchat-android-v6-builder-settings/SKILL.md +1 -1
- package/skills/cometchat-android-v6-calls/SKILL.md +375 -0
- package/skills/cometchat-android-v6-calls/references/add-calls-to-existing-chat.md +97 -0
- package/skills/cometchat-android-v6-calls/references/call-layouts.md +91 -0
- package/skills/cometchat-android-v6-calls/references/call-session.md +163 -0
- package/skills/cometchat-android-v6-calls/references/device-management.md +171 -0
- package/skills/cometchat-android-v6-calls/references/group-calls.md +191 -0
- package/skills/cometchat-android-v6-calls/references/idle-timeout.md +107 -0
- package/skills/cometchat-android-v6-calls/references/in-call-chat.md +136 -0
- package/skills/cometchat-android-v6-calls/references/raise-hand.md +186 -0
- package/skills/cometchat-android-v6-calls/references/ringing-integration.md +176 -0
- package/skills/cometchat-android-v6-calls/references/server-fcm-voip.md +127 -0
- package/skills/cometchat-android-v6-calls/references/share-invite.md +105 -0
- package/skills/cometchat-android-v6-compose-components/SKILL.md +2 -2
- package/skills/cometchat-android-v6-compose-customization/SKILL.md +1 -1
- package/skills/cometchat-android-v6-compose-placement/SKILL.md +1 -1
- package/skills/cometchat-android-v6-compose-theming/SKILL.md +1 -1
- package/skills/cometchat-android-v6-core/SKILL.md +1 -1
- package/skills/cometchat-android-v6-events/SKILL.md +1 -1
- package/skills/cometchat-android-v6-extensions/SKILL.md +1 -1
- package/skills/cometchat-android-v6-features/SKILL.md +1 -1
- package/skills/cometchat-android-v6-kotlin-components/SKILL.md +1 -1
- package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +1 -1
- package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +1 -1
- package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +1 -1
- package/skills/cometchat-android-v6-migration/SKILL.md +398 -0
- package/skills/cometchat-android-v6-production/SKILL.md +1 -1
- package/skills/cometchat-android-v6-push/SKILL.md +1 -1
- package/skills/cometchat-android-v6-testing/SKILL.md +1 -1
- package/skills/cometchat-android-v6-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-angular-calls/SKILL.md +511 -0
- package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +95 -0
- package/skills/cometchat-angular-calls/references/call-layouts.md +106 -0
- package/skills/cometchat-angular-calls/references/call-session.md +167 -0
- package/skills/cometchat-angular-calls/references/custom-ui.md +231 -0
- package/skills/cometchat-angular-calls/references/device-management.md +135 -0
- package/skills/cometchat-angular-calls/references/group-calls.md +412 -0
- package/skills/cometchat-angular-calls/references/idle-timeout.md +145 -0
- package/skills/cometchat-angular-calls/references/in-call-chat.md +148 -0
- package/skills/cometchat-angular-calls/references/lazy-loading-pitfalls.md +205 -0
- package/skills/cometchat-angular-calls/references/migration-v4-to-v5.md +53 -0
- package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +183 -0
- package/skills/cometchat-angular-calls/references/picture-in-picture.md +285 -0
- package/skills/cometchat-angular-calls/references/raise-hand.md +167 -0
- package/skills/cometchat-angular-calls/references/recording-screen-share.md +267 -0
- package/skills/cometchat-angular-calls/references/ringing-integration.md +131 -0
- package/skills/cometchat-angular-calls/references/server-web-push-vapid.md +100 -0
- package/skills/cometchat-angular-calls/references/share-invite.md +116 -0
- package/skills/cometchat-angular-components/SKILL.md +1 -1
- package/skills/cometchat-angular-core/SKILL.md +1 -1
- package/skills/cometchat-angular-customization/SKILL.md +1 -1
- package/skills/cometchat-angular-features/SKILL.md +1 -1
- package/skills/cometchat-angular-patterns/SKILL.md +1 -1
- package/skills/cometchat-angular-placement/SKILL.md +1 -1
- package/skills/cometchat-angular-production/SKILL.md +1 -1
- package/skills/cometchat-angular-push/SKILL.md +403 -0
- package/skills/cometchat-angular-testing/SKILL.md +333 -0
- package/skills/cometchat-angular-theming/SKILL.md +1 -1
- package/skills/cometchat-angular-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-astro-patterns/SKILL.md +1 -1
- package/skills/cometchat-calls/SKILL.md +358 -0
- package/skills/cometchat-calls/references/use-case-broadcast.md +194 -0
- package/skills/cometchat-calls/references/use-case-marketplace.md +158 -0
- package/skills/cometchat-calls/references/use-case-support.md +190 -0
- package/skills/cometchat-calls/references/use-case-team.md +169 -0
- package/skills/cometchat-calls/references/use-case-telehealth.md +154 -0
- package/skills/cometchat-components/SKILL.md +1 -1
- package/skills/cometchat-core/SKILL.md +1 -1
- package/skills/cometchat-customization/SKILL.md +2 -2
- package/skills/cometchat-features/SKILL.md +2 -2
- package/skills/cometchat-flutter-v5/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-calls/SKILL.md +325 -94
- package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +169 -0
- package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +98 -0
- package/skills/cometchat-flutter-v5-calls/references/call-session.md +330 -0
- package/skills/cometchat-flutter-v5-calls/references/device-management.md +120 -0
- package/skills/cometchat-flutter-v5-calls/references/group-calls.md +187 -0
- package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +97 -0
- package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +132 -0
- package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +160 -0
- package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +244 -0
- package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +193 -0
- package/skills/cometchat-flutter-v5-calls/references/server-push-bridge.md +101 -0
- package/skills/cometchat-flutter-v5-calls/references/share-invite.md +142 -0
- package/skills/cometchat-flutter-v5-conversations/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-core/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-customization/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-events/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-messages/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-production/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-push/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-testing/SKILL.md +390 -0
- package/skills/cometchat-flutter-v5-theming/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-users-groups/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-calls/SKILL.md +308 -243
- package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +134 -0
- package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +102 -0
- package/skills/cometchat-flutter-v6-calls/references/call-session.md +229 -0
- package/skills/cometchat-flutter-v6-calls/references/device-management.md +99 -0
- package/skills/cometchat-flutter-v6-calls/references/group-calls.md +190 -0
- package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +80 -0
- package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +122 -0
- package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +268 -0
- package/skills/cometchat-flutter-v6-calls/references/ringing-integration.md +171 -0
- package/skills/cometchat-flutter-v6-calls/references/server-push-bridge.md +93 -0
- package/skills/cometchat-flutter-v6-calls/references/share-invite.md +102 -0
- package/skills/cometchat-flutter-v6-components/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-conversations/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-core/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-customization/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-events/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-features/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-messages/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-migration/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-placement/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-production/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-push/SKILL.md +452 -0
- package/skills/cometchat-flutter-v6-testing/SKILL.md +319 -0
- package/skills/cometchat-flutter-v6-theming/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-users-groups/SKILL.md +1 -1
- package/skills/cometchat-i18n/SKILL.md +358 -0
- package/skills/cometchat-ios/SKILL.md +5 -5
- package/skills/cometchat-ios-calls/SKILL.md +409 -0
- package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +172 -0
- package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +189 -0
- package/skills/cometchat-ios-calls/references/call-layouts.md +136 -0
- package/skills/cometchat-ios-calls/references/call-session.md +221 -0
- package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +353 -0
- package/skills/cometchat-ios-calls/references/custom-ui.md +322 -0
- package/skills/cometchat-ios-calls/references/device-management.md +171 -0
- package/skills/cometchat-ios-calls/references/group-calls.md +396 -0
- package/skills/cometchat-ios-calls/references/idle-timeout.md +185 -0
- package/skills/cometchat-ios-calls/references/in-call-chat.md +183 -0
- package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +138 -0
- package/skills/cometchat-ios-calls/references/picture-in-picture.md +246 -0
- package/skills/cometchat-ios-calls/references/raise-hand.md +239 -0
- package/skills/cometchat-ios-calls/references/recording-screen-share.md +339 -0
- package/skills/cometchat-ios-calls/references/ringing-integration.md +142 -0
- package/skills/cometchat-ios-calls/references/server-apns-pushkit.md +267 -0
- package/skills/cometchat-ios-calls/references/share-invite.md +152 -0
- package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +246 -0
- package/skills/cometchat-ios-calls/references/voip-cert-setup.md +166 -0
- package/skills/cometchat-ios-components/SKILL.md +1 -1
- package/skills/cometchat-ios-core/SKILL.md +1 -1
- package/skills/cometchat-ios-customization/SKILL.md +1 -1
- package/skills/cometchat-ios-features/SKILL.md +1 -1
- package/skills/cometchat-ios-placement/SKILL.md +1 -1
- package/skills/cometchat-ios-production/SKILL.md +1 -1
- package/skills/cometchat-ios-push/SKILL.md +1 -1
- package/skills/cometchat-ios-testing/SKILL.md +371 -0
- package/skills/cometchat-ios-theming/SKILL.md +1 -1
- package/skills/cometchat-ios-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-native-bare-patterns/SKILL.md +45 -3
- package/skills/cometchat-native-calls/SKILL.md +599 -0
- package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +203 -0
- package/skills/cometchat-native-calls/references/call-layouts.md +124 -0
- package/skills/cometchat-native-calls/references/call-session.md +182 -0
- package/skills/cometchat-native-calls/references/custom-ui.md +250 -0
- package/skills/cometchat-native-calls/references/device-management.md +135 -0
- package/skills/cometchat-native-calls/references/expo-vs-bare.md +179 -0
- package/skills/cometchat-native-calls/references/group-calls.md +291 -0
- package/skills/cometchat-native-calls/references/idle-timeout.md +128 -0
- package/skills/cometchat-native-calls/references/in-call-chat.md +143 -0
- package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +72 -0
- package/skills/cometchat-native-calls/references/picture-in-picture.md +276 -0
- package/skills/cometchat-native-calls/references/raise-hand.md +203 -0
- package/skills/cometchat-native-calls/references/recording-screen-share.md +290 -0
- package/skills/cometchat-native-calls/references/ringing-integration.md +118 -0
- package/skills/cometchat-native-calls/references/server-push-bridge.md +135 -0
- package/skills/cometchat-native-calls/references/server-push-payloads.md +193 -0
- package/skills/cometchat-native-calls/references/share-invite.md +144 -0
- package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +317 -0
- package/skills/cometchat-native-components/SKILL.md +1 -1
- package/skills/cometchat-native-core/SKILL.md +1 -1
- package/skills/cometchat-native-customization/SKILL.md +1 -1
- package/skills/cometchat-native-expo-patterns/SKILL.md +18 -1
- package/skills/cometchat-native-features/SKILL.md +1 -1
- package/skills/cometchat-native-placement/SKILL.md +1 -1
- package/skills/cometchat-native-production/SKILL.md +1 -1
- package/skills/cometchat-native-push/SKILL.md +1 -1
- package/skills/cometchat-native-testing/SKILL.md +1 -1
- package/skills/cometchat-native-theming/SKILL.md +1 -1
- package/skills/cometchat-native-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-nextjs-patterns/SKILL.md +1 -1
- package/skills/cometchat-placement/SKILL.md +1 -1
- package/skills/cometchat-production/SKILL.md +1 -1
- package/skills/cometchat-react-calls/SKILL.md +539 -0
- package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +145 -0
- package/skills/cometchat-react-calls/references/call-layouts.md +161 -0
- package/skills/cometchat-react-calls/references/call-session.md +235 -0
- package/skills/cometchat-react-calls/references/custom-ui.md +201 -0
- package/skills/cometchat-react-calls/references/device-management.md +206 -0
- package/skills/cometchat-react-calls/references/group-calls.md +262 -0
- package/skills/cometchat-react-calls/references/idle-timeout.md +175 -0
- package/skills/cometchat-react-calls/references/in-call-chat.md +212 -0
- package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +172 -0
- package/skills/cometchat-react-calls/references/picture-in-picture.md +245 -0
- package/skills/cometchat-react-calls/references/raise-hand.md +238 -0
- package/skills/cometchat-react-calls/references/recording-screen-share.md +143 -0
- package/skills/cometchat-react-calls/references/ringing-integration.md +255 -0
- package/skills/cometchat-react-calls/references/server-web-push-vapid.md +241 -0
- package/skills/cometchat-react-calls/references/share-invite.md +176 -0
- package/skills/cometchat-react-calls/references/testing-calls-on-web.md +198 -0
- package/skills/cometchat-react-calls/references/voip-and-web-push.md +165 -0
- package/skills/cometchat-react-patterns/SKILL.md +1 -1
- package/skills/cometchat-react-push/SKILL.md +448 -0
- package/skills/cometchat-react-router-patterns/SKILL.md +1 -1
- package/skills/cometchat-react-testing/SKILL.md +404 -0
- package/skills/cometchat-theming/SKILL.md +3 -3
- package/skills/cometchat-troubleshooting/SKILL.md +2 -2
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cometchat-flutter-v6-testing
|
|
3
|
+
description: Testing patterns for CometChat Flutter UIKit v6 (beta, Bloc-based). Covers flutter_test + bloc_test for Bloc unit tests, mocktail for SDK mocking, widget tests around the Bloc-driven CometChat widgets, integration_test for real-device flows, golden tests for theming, and CI on GitHub Actions / Codemagic. Sister skill of cometchat-flutter-v5-testing — the cohorts have different state-management primitives (GetX vs Bloc) so the patterns differ.
|
|
4
|
+
license: "MIT"
|
|
5
|
+
compatibility: "Flutter >= 2.5, Dart >= 3.0; flutter_test (built-in); bloc_test >= 9.0; mocktail >= 1.0; integration_test (built-in); cometchat_chat_uikit ^6.0.0-beta2"
|
|
6
|
+
allowed-tools: "shell, file-read, file-search, file-list, ask-user"
|
|
7
|
+
metadata:
|
|
8
|
+
author: "CometChat"
|
|
9
|
+
version: "4.0.0"
|
|
10
|
+
tags: "cometchat flutter v6 testing flutter-test bloc bloc-test mocktail widget-test integration-test golden-test ci codemagic"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Test recipes for Flutter UIKit v6 (beta, Bloc-based). Most of the v5 patterns carry over; the deltas are around state-management primitives (Bloc, not GetX) and the unified `cometchat_chat_uikit` package (calls bundled — see `cometchat-flutter-v6-calls`).
|
|
16
|
+
|
|
17
|
+
**Read these other skills first:**
|
|
18
|
+
- `cometchat-flutter-v6-core` — UIKitSettings, init/login order, hard rules
|
|
19
|
+
- `cometchat-flutter-v6-events` — Bloc-based event streams
|
|
20
|
+
- `cometchat-flutter-v5-testing` — patterns that aren't v6-specific (CI config, golden tests, mocktail intro) — read first if you haven't
|
|
21
|
+
|
|
22
|
+
**Ground truth:**
|
|
23
|
+
- bloc_test — https://pub.dev/packages/bloc_test
|
|
24
|
+
- flutter_bloc — https://bloclibrary.dev/
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 1. The v5 → v6 testing delta
|
|
29
|
+
|
|
30
|
+
| Concern | v5 | v6 |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| State management | GetX | Bloc |
|
|
33
|
+
| DI in tests | `Get.reset()` between tests | Provide via `MultiBlocProvider` per test, or use `BlocProvider.value` with a mock |
|
|
34
|
+
| Calls package | `cometchat_calls_uikit` (separate) | bundled into `cometchat_chat_uikit` |
|
|
35
|
+
| Init order | `..callingExtension = CometChatCallingExtension()` on UIKitSettingsBuilder | `CometChatUIKitCalls.init` inside `CometChatUIKit.init` onSuccess |
|
|
36
|
+
| Listener IDs | Stable string for `addCallListener` | Bloc subscription, automatic cleanup |
|
|
37
|
+
| State persistence between tests | Get singletons leak — must reset | Bloc state is per-instance — no global reset, but providers must be re-created per test |
|
|
38
|
+
|
|
39
|
+
Most assertions stay the same; the wiring around them changes.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 2. Mocktail + bloc_test setup
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
# pubspec.yaml
|
|
47
|
+
dev_dependencies:
|
|
48
|
+
flutter_test:
|
|
49
|
+
sdk: flutter
|
|
50
|
+
bloc_test: ^9.0.0
|
|
51
|
+
mocktail: ^1.0.0
|
|
52
|
+
integration_test:
|
|
53
|
+
sdk: flutter
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Service abstraction
|
|
57
|
+
|
|
58
|
+
Same shape as v5 (see `cometchat-flutter-v5-testing/SKILL.md` Section 2):
|
|
59
|
+
|
|
60
|
+
```dart
|
|
61
|
+
// lib/services/cometchat_service.dart
|
|
62
|
+
abstract class CometChatService {
|
|
63
|
+
Future<void> init();
|
|
64
|
+
Future<User> login(String uid);
|
|
65
|
+
Future<void> logout();
|
|
66
|
+
User? getLoggedInUser();
|
|
67
|
+
Stream<TextMessage> messageStream();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
class CometChatServiceImpl implements CometChatService {
|
|
71
|
+
@override
|
|
72
|
+
Future<void> init() async {
|
|
73
|
+
final settings = (UIKitSettings.builder()
|
|
74
|
+
..appId = CometChatConfig.appId
|
|
75
|
+
..region = CometChatConfig.region
|
|
76
|
+
..authKey = CometChatConfig.authKey
|
|
77
|
+
..subscriptionType = CometChatSubscriptionType.allUsers)
|
|
78
|
+
.build();
|
|
79
|
+
|
|
80
|
+
await Future<void>.value(); // Real impl: completer-wrap CometChatUIKit.init
|
|
81
|
+
// Then chain calls init in onSuccess (rule 1.1 from cometchat-flutter-v6-calls)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ... rest
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 3. Bloc unit tests with bloc_test
|
|
91
|
+
|
|
92
|
+
```dart
|
|
93
|
+
// test/blocs/auth_bloc_test.dart
|
|
94
|
+
import 'package:bloc_test/bloc_test.dart';
|
|
95
|
+
import 'package:flutter_test/flutter_test.dart';
|
|
96
|
+
import 'package:mocktail/mocktail.dart';
|
|
97
|
+
import 'package:your_app/blocs/auth_bloc.dart';
|
|
98
|
+
import 'package:your_app/services/cometchat_service.dart';
|
|
99
|
+
|
|
100
|
+
class MockCometChatService extends Mock implements CometChatService {}
|
|
101
|
+
class FakeAuthEvent extends Fake implements AuthEvent {}
|
|
102
|
+
|
|
103
|
+
void main() {
|
|
104
|
+
late MockCometChatService mockService;
|
|
105
|
+
|
|
106
|
+
setUpAll(() {
|
|
107
|
+
registerFallbackValue(FakeAuthEvent());
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
setUp(() {
|
|
111
|
+
mockService = MockCometChatService();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
blocTest<AuthBloc, AuthState>(
|
|
115
|
+
'emits Authenticated when login succeeds',
|
|
116
|
+
setUp: () {
|
|
117
|
+
when(() => mockService.init()).thenAnswer((_) async {});
|
|
118
|
+
when(() => mockService.login(any())).thenAnswer(
|
|
119
|
+
(_) async => User(uid: 'cometchat-uid-1', name: 'Alice'),
|
|
120
|
+
);
|
|
121
|
+
},
|
|
122
|
+
build: () => AuthBloc(service: mockService),
|
|
123
|
+
act: (bloc) => bloc.add(LoginRequested(uid: 'cometchat-uid-1')),
|
|
124
|
+
expect: () => [
|
|
125
|
+
isA<AuthLoading>(),
|
|
126
|
+
isA<Authenticated>(),
|
|
127
|
+
],
|
|
128
|
+
verify: (_) {
|
|
129
|
+
verify(() => mockService.init()).called(1);
|
|
130
|
+
verify(() => mockService.login('cometchat-uid-1')).called(1);
|
|
131
|
+
},
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
blocTest<AuthBloc, AuthState>(
|
|
135
|
+
'emits AuthError when login fails',
|
|
136
|
+
setUp: () {
|
|
137
|
+
when(() => mockService.init()).thenAnswer((_) async {});
|
|
138
|
+
when(() => mockService.login(any())).thenThrow(Exception('401 Unauthorized'));
|
|
139
|
+
},
|
|
140
|
+
build: () => AuthBloc(service: mockService),
|
|
141
|
+
act: (bloc) => bloc.add(LoginRequested(uid: 'cometchat-uid-1')),
|
|
142
|
+
expect: () => [
|
|
143
|
+
isA<AuthLoading>(),
|
|
144
|
+
predicate<AuthState>((s) => s is AuthError && s.message.contains('Unauthorized')),
|
|
145
|
+
],
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`bloc_test` handles the boilerplate of subscribing to the bloc, dispatching events, and asserting state sequence.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 4. Widget tests with BlocProvider
|
|
155
|
+
|
|
156
|
+
```dart
|
|
157
|
+
import 'package:flutter/material.dart';
|
|
158
|
+
import 'package:flutter_test/flutter_test.dart';
|
|
159
|
+
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
160
|
+
import 'package:mocktail/mocktail.dart';
|
|
161
|
+
import 'package:your_app/screens/chat_screen.dart';
|
|
162
|
+
import 'package:your_app/blocs/auth_bloc.dart';
|
|
163
|
+
|
|
164
|
+
class MockAuthBloc extends MockBloc<AuthEvent, AuthState> implements AuthBloc {}
|
|
165
|
+
class FakeAuthState extends Fake implements AuthState {}
|
|
166
|
+
class FakeAuthEvent extends Fake implements AuthEvent {}
|
|
167
|
+
|
|
168
|
+
void main() {
|
|
169
|
+
setUpAll(() {
|
|
170
|
+
registerFallbackValue(FakeAuthState());
|
|
171
|
+
registerFallbackValue(FakeAuthEvent());
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
testWidgets('shows loading on AuthLoading state', (tester) async {
|
|
175
|
+
final mockBloc = MockAuthBloc();
|
|
176
|
+
when(() => mockBloc.state).thenReturn(AuthLoading());
|
|
177
|
+
|
|
178
|
+
await tester.pumpWidget(
|
|
179
|
+
MaterialApp(
|
|
180
|
+
home: BlocProvider<AuthBloc>.value(
|
|
181
|
+
value: mockBloc,
|
|
182
|
+
child: ChatScreen(),
|
|
183
|
+
),
|
|
184
|
+
),
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
expect(find.byType(CircularProgressIndicator), findsOneWidget);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
testWidgets('shows error on AuthError state', (tester) async {
|
|
191
|
+
final mockBloc = MockAuthBloc();
|
|
192
|
+
when(() => mockBloc.state).thenReturn(AuthError(message: '401 Unauthorized'));
|
|
193
|
+
|
|
194
|
+
await tester.pumpWidget(
|
|
195
|
+
MaterialApp(
|
|
196
|
+
home: BlocProvider<AuthBloc>.value(value: mockBloc, child: ChatScreen()),
|
|
197
|
+
),
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
expect(find.textContaining('Unauthorized'), findsOneWidget);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
`BlocProvider.value` is for tests; `BlocProvider(create: ...)` is for production.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 5. Mocking the kit's call widgets
|
|
210
|
+
|
|
211
|
+
V6 calls widgets fire BLoC events internally. Mocking is the same pattern — wrap your custom call surfaces in service abstractions, mock at that layer.
|
|
212
|
+
|
|
213
|
+
For widgets like `<CometChatOngoingCall>` that you don't control, the strategy is the same as v5: replace at composition boundary or skip widget tests for them and rely on integration tests.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 6. Integration tests (same as v5)
|
|
218
|
+
|
|
219
|
+
```dart
|
|
220
|
+
// integration_test/chat_test.dart
|
|
221
|
+
import 'package:flutter/material.dart';
|
|
222
|
+
import 'package:flutter_test/flutter_test.dart';
|
|
223
|
+
import 'package:integration_test/integration_test.dart';
|
|
224
|
+
import 'package:your_app/main.dart' as app;
|
|
225
|
+
|
|
226
|
+
void main() {
|
|
227
|
+
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
|
228
|
+
|
|
229
|
+
testWidgets('login and see conversations', (tester) async {
|
|
230
|
+
app.main();
|
|
231
|
+
await tester.pumpAndSettle(Duration(seconds: 10));
|
|
232
|
+
|
|
233
|
+
expect(find.text('Welcome'), findsOneWidget);
|
|
234
|
+
|
|
235
|
+
await tester.tap(find.text('Messages'));
|
|
236
|
+
await tester.pumpAndSettle();
|
|
237
|
+
|
|
238
|
+
expect(find.byType(ListTile), findsAtLeastNWidgets(1));
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Same shape as v5; the underlying SDK is different but the integration test contract is the same.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## 7. Golden tests (same as v5)
|
|
248
|
+
|
|
249
|
+
See `cometchat-flutter-v5-testing/SKILL.md` Section 6 — the patterns are identical. The kit's V6 themes use Material 3 by default; pin Flutter version to ensure golden stability.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## 8. Calls testing in v6
|
|
254
|
+
|
|
255
|
+
V6 bundles calls into `cometchat_chat_uikit`. Tests that touch calls:
|
|
256
|
+
|
|
257
|
+
```dart
|
|
258
|
+
blocTest<CallBloc, CallState>(
|
|
259
|
+
'emits CallActive when initiateCall succeeds',
|
|
260
|
+
setUp: () {
|
|
261
|
+
when(() => mockService.initiateCall(any())).thenAnswer(
|
|
262
|
+
(_) async => Call(sessionId: 'session-123'),
|
|
263
|
+
);
|
|
264
|
+
},
|
|
265
|
+
build: () => CallBloc(service: mockService),
|
|
266
|
+
act: (bloc) => bloc.add(InitiateCall(receiverUid: 'cometchat-uid-2')),
|
|
267
|
+
expect: () => [isA<CallInitiating>(), isA<CallActive>()],
|
|
268
|
+
);
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**The init order rule applies in tests too:** mock `init` to resolve before any `initiateCall`-related test runs. The simplest way is to wire init in your test's `setUpAll`:
|
|
272
|
+
|
|
273
|
+
```dart
|
|
274
|
+
setUpAll(() async {
|
|
275
|
+
registerFallbackValue(FakeCallEvent());
|
|
276
|
+
// If your AuthBloc init is shared, run it once here:
|
|
277
|
+
// await mockAuthBloc.add(AppStarted());
|
|
278
|
+
});
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
For widget tests of call screens, see `cometchat-flutter-v6-calls` Section 7's verification checklist — the same checks belong in the test file:
|
|
282
|
+
|
|
283
|
+
- Was init called before the call screen mounted?
|
|
284
|
+
- Does the call screen show the WebRTC view after the session starts?
|
|
285
|
+
- Does hangup call `endSession` AND `Navigator.pop`?
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## 9. Anti-patterns
|
|
290
|
+
|
|
291
|
+
1. **Reusing a single `MockBloc` across tests** without resetting. State leaks. Either re-create per test or use `tearDown(() => mockBloc.close())`.
|
|
292
|
+
2. **Skipping `registerFallbackValue` for events / states.** mocktail crashes the test runner without it; the error message is unclear.
|
|
293
|
+
3. **`Bloc` subclasses with side effects in their constructor.** Tests mount the bloc and side effects fire (e.g. real SDK init). Move side effects to event handlers, dispatch them explicitly in tests.
|
|
294
|
+
4. **`emit` checks that depend on equality.** Bloc states often have `Equatable` mixed in; if not, `expect: () => [SomeState()]` fails because two `SomeState()` instances aren't equal. Use `predicate<T>(...)` or verify via `isA<SomeState>()` + later assertions.
|
|
295
|
+
5. **Real `flutter_bloc` ChangeNotifierProvider in widget tests.** Mock the bloc directly via `BlocProvider.value(value: mockBloc)`.
|
|
296
|
+
6. **Skipping pump after state emit.** `bloc_test` handles state assertions, but widget tests need explicit `await tester.pump()` after the bloc emits or the rebuild won't happen.
|
|
297
|
+
|
|
298
|
+
## 10. Verification checklist
|
|
299
|
+
|
|
300
|
+
- [ ] `CometChatService` abstraction wrapping the SDK
|
|
301
|
+
- [ ] `MockCometChatService` and `MockAuthBloc` (`MockBloc<E, S>`) in test files
|
|
302
|
+
- [ ] `registerFallbackValue` calls in `setUpAll` for events + states
|
|
303
|
+
- [ ] At least one bloc_test for "AuthBloc emits Authenticated on successful login"
|
|
304
|
+
- [ ] At least one bloc_test for "AuthBloc emits AuthError on login failure"
|
|
305
|
+
- [ ] At least one widget test for "shows loading until login resolves"
|
|
306
|
+
- [ ] At least one widget test for "error UI on auth failure"
|
|
307
|
+
- [ ] Integration test for login + see conversations
|
|
308
|
+
- [ ] Calls integration test asserting init order rule (chat init → calls init → calls available)
|
|
309
|
+
- [ ] CI uses dedicated CometChat test app via `--dart-define`
|
|
310
|
+
- [ ] Flutter version pinned in CI
|
|
311
|
+
|
|
312
|
+
## 11. Pointers
|
|
313
|
+
|
|
314
|
+
- `cometchat-flutter-v6-core` — init/login order, hard rules
|
|
315
|
+
- `cometchat-flutter-v6-events` — Bloc event streams
|
|
316
|
+
- `cometchat-flutter-v6-calls` — calls integration; hard rules to assert in tests
|
|
317
|
+
- `cometchat-flutter-v6-troubleshooting` — when tests pass but production breaks
|
|
318
|
+
- `cometchat-flutter-v5-testing` — for shared patterns (CI, goldens, mocktail intro)
|
|
319
|
+
- `cometchat-flutter-v6-migration` — v5 → v6 migration recipes (test rewrites)
|
|
@@ -10,7 +10,7 @@ description: >
|
|
|
10
10
|
user asks about changing colors, fonts, spacing, or appearance of chat components.
|
|
11
11
|
license: "MIT"
|
|
12
12
|
compatibility: "cometchat_chat_uikit ^6.0.0-beta2; flutter >=2.5.0"
|
|
13
|
-
allowed-tools: "
|
|
13
|
+
allowed-tools: "shell, file-read, file-search, file-list, grep"
|
|
14
14
|
metadata:
|
|
15
15
|
author: "CometChat"
|
|
16
16
|
version: "3.0.0"
|
|
@@ -7,7 +7,7 @@ description: >
|
|
|
7
7
|
errors, crashes, or unexpected behavior with CometChat components.
|
|
8
8
|
license: "MIT"
|
|
9
9
|
compatibility: "cometchat_chat_uikit ^6.0.0-beta2"
|
|
10
|
-
allowed-tools: "
|
|
10
|
+
allowed-tools: "shell, file-read, file-search, file-list, grep"
|
|
11
11
|
metadata:
|
|
12
12
|
author: "CometChat"
|
|
13
13
|
version: "3.0.0"
|
|
@@ -9,7 +9,7 @@ description: >
|
|
|
9
9
|
GroupMembersRequestBuilder, or customizing user/group list items.
|
|
10
10
|
license: "MIT"
|
|
11
11
|
compatibility: "cometchat_chat_uikit ^6.0.0-beta2; flutter_bloc ^8.1.0"
|
|
12
|
-
allowed-tools: "
|
|
12
|
+
allowed-tools: "shell, file-read, file-search, file-list, grep"
|
|
13
13
|
metadata:
|
|
14
14
|
author: "CometChat"
|
|
15
15
|
version: "3.0.0"
|