/cometchat-skills:cometchat-react-native-testingfrom cometchat-skills
Tests CometChat React Native integrations: mocks SDK for Jest unit tests, asserts init-before-render ordering and no Auth-Key-in-source, and uses Detox for device-only flows like keyboard and navigation.
Ships in cometchat-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Ground truth:
catalogs/rn-v5.json+catalogs/rn-sdk-v4.json. Build the feature; do NOT test it unless asked. Use this skill only when the developer asks for tests. Never add a test framework, e2e suite or CI to a project that did not request one.
cometchat-react-native-core — install, provider chain, init→login→render. Assumed, not repeated here.React Native ships Jest. Add the renderer:
npm install --save-dev @testing-library/react-native
CometChat opens a websocket and needs real credentials. Mock at the module boundary:
jest.mock("@cometchat/chat-sdk-react-native", () => ({
CometChat: {
init: jest.fn().mockResolvedValue(true),
login: jest.fn().mockResolvedValue({ getUid: () => "test-uid" }),
logout: jest.fn().mockResolvedValue(true),
AppSettings: { SUBSCRIPTION_TYPE_ALL_USERS: "ALL_USERS" },
},
}));
The UI Kit also pulls native modules, so mock the peers your test path touches —
react-native-gesture-handler, react-native-svg, react-native-video,
@react-native-async-storage/async-storage. Without them the failure is a NativeModule error that
never mentions CometChat: the same confusing shape as a missing install.
Ordering — the invariant most likely to regress: init resolves before login, and no chat
component renders until login resolves.
No Auth Key in source — a cheap grep test that stops a shipped secret ever landing:
it("has no auth key in source", () => {
const src = require("fs").readFileSync("src/config.ts", "utf8");
expect(src).not.toMatch(/authKey\s*:\s*["'][A-Za-z0-9]{20,}/);
});
Wiring, not rendering — that onItemPress navigates, that onBack returns, that an opened
surface can be closed. Unwired affordances are the defect class worth catching.
Do not assert on kit internals — bubble markup, class names, child order. Those change between minors, so the test breaks with nothing actually wrong.
| Flow | Why it cannot be a unit test |
|---|---|
| composer survives the keyboard | needs a real soft keyboard |
| hardware back navigates | needs the OS back gesture |
| gestures respond | proves GestureHandlerRootView is wired |
| release-build startup | catches the gesture-handler import-order crash |
Calls and push are outside Detox too — they need real hardware, real permissions and a second device. Record them as manual device checks rather than pretending they are automated.
Jest with mocks runs anywhere. Detox needs a simulator — heavier, but feasible. Neither can verify calls or push, so a green CI run is not evidence that either works.
npm run verify:fences:rn-v5 is green.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
cometchat, react-native-testing, jest-mocking, detox, chat-testing
npx claudepluginhub cometchat/cometchat-skills --plugin cometchat-skills98 skills in this plugin
/cometchatEntry point for any CometChat task on any platform. Detects the framework + UI Kit version (React, Angular, iOS, Android, React Native, Flutter), then routes to that family's skills — for a NEW integration or a change to an existing one. Triggers: 'add chat', 'add cometchat', 'add chat to my app', 'add calling', 'change something in my chat', 'my chat is already set up', 'add a feature to the chat', 'add chat to my android app', 'integrate cometchat android', 'add chat to my ios app', 'integrate cometchat ios', 'add chat to my swift app', 'migrate my app to cometchat', 'migrate from sendbird', 'migrate from getstream / stream', 'replace sendbird / stream chat with cometchat', 'build a <app> clone', 'make a chat app like <app>', 'make it look and work like <app>'./cometchat-a11yKeep a CometChat integration accessible — the UI Kit is designed targeting WCAG 2.1 AA with keyboard navigation (verify per component in its docs; full conformance still needs manual testing), and this skill makes sure the HOST app doesn't break that, covering contrast, focus, screen-reader context, reduced motion, RTL, and calls accessibility. Cross-family. Triggers: 'is cometchat accessible', 'WCAG / 508 / ADA compliance', 'screen reader support', 'keyboard navigation', 'a11y audit', 'accessible chat', 'contrast/focus issues in chat'.Other plugins' skills for the same job