/cometchat-skills:cometchat-angular-v5-testingfrom cometchat-skills
Provides testing strategies for Angular apps using CometChat v5 UI Kit: what to mock vs exercise, TestBed setup for standalone components, avoiding real network in unit tests, and two-account manual e2e for realtime.
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:
@cometchat/chat-uikit-angular@5(5.1.0–5.2.2 verified). The Angular UI Kit docs have no testing page — the strategy here is the pack's own, and is labelled as such rather than presented as documented (a tracked DOCS GAP). Any kit symbol a test mocks must still exist in theangular-v5catalog, and its real shape comes from the component's.mdtwin viacometchat-angular-v5-core/references/docs-map.md— mock the API the kit actually exposes, never one invented to fit the test.
cometchat-angular-v5-core — init/login lifecycle, which is what makes tests hang if unmocked.Writing tests for a component that renders kit components, or diagnosing tests that hang or fail on network.
| Testing | Approach |
|---|---|
| Your logic — selection, routing, state | Unit test with CometChat mocked |
| Kit component internals | Don't. It is a third-party dependency with its own tests |
| Your app's chat flow end-to-end | Playwright against a real dev app, two accounts |
| Realtime delivery | Manual, two browsers. Not automatable cheaply |
The common mistake is unit-testing kit internals. Test the seam: given a click, does your component set the right active chat?
Kit components open sockets and call the API at construction. Left real, tests hang, fail offline, and pollute a live app with test data.
// src/testing/cometchat.mock.ts
export const cometChatUIKitMock = {
initFromSettings: jest.fn().mockResolvedValue({}),
login: jest.fn().mockResolvedValue({ getUid: () => 'test-uid' }),
loginWithAuthToken: jest.fn().mockResolvedValue({ getUid: () => 'test-uid' }),
logout: jest.fn().mockResolvedValue(undefined),
getLoggedInUser: jest.fn().mockReturnValue({ getUid: () => 'test-uid' }),
isInitialized: jest.fn().mockReturnValue(true),
isCallingEnabled: jest.fn().mockReturnValue(false),
};
Point the module at it (Jest):
jest.mock('@cometchat/chat-uikit-angular', () => ({
...jest.requireActual('@cometchat/chat-uikit-angular'),
CometChatUIKit: cometChatUIKitMock,
}));
Keep requireActual so real component classes and ChatStateService still exist — you want your own wiring exercised, only the network faked.
They are standalone, so they go in imports, exactly as in the app:
import { TestBed } from '@angular/core/testing';
import { ChatComponent } from './chat.component';
beforeEach(async () => {
await TestBed.configureTestingModule({ imports: [ChatComponent] }).compileComponents();
});
If a test fails with "is not a known element", the component under test is missing it from its own imports — a real bug the test just caught, not a test problem.
Assert state, not kit markup. Kit internals change between releases; your wiring should not.
it('sets the active group when a group conversation is clicked', () => {
const fixture = TestBed.createComponent(ChatComponent);
const cmp = fixture.componentInstance;
// Mock the SHAPE the kit actually emits: a Conversation whose subject is a Group.
// Handing open() a bare { getGuid } instead lets a duck-typing bug pass the test
// while every group chat throws "getUid is not a function" in the browser.
const group = new CometChat.Group('g1', 'Team', CometChat.GROUP_TYPE.PUBLIC);
const conversation = { getConversationType: () => 'group', getConversationWith: () => group };
cmp.open(conversation as unknown as CometChat.Conversation);
expect(cmp.chatState.getActiveGroup()).toBeTruthy();
expect(cmp.chatState.getActiveUser()).toBeFalsy(); // the group must NOT land in the user slot
});
Mock the emitted shape, not the shape your code happens to check. A mock built backwards from the implementation can only confirm the implementation — including its bugs.
(itemClick)emits aConversation; a test that passes anything else is not exercising the wiring.
Use a real dev app and two seeded users. What is worth asserting:
const box = await page.locator('cometchat-message-list').boundingBox();
expect(box!.height).toBeGreaterThan(100);
Seed users and conversations through the REST API in setup, not the UI.
Realtime delivery between two clients, calls (needs media permissions and two peers), and push (needs a real device and a backgrounded app). Verify these manually and say so in the test plan rather than writing brittle automation.
requireActual → your own wiring never runs.Unit tests pass offline · no test opens a real socket · a missing imports entry fails a test · E2E asserts non-zero height and no console errors · manual checks are documented, not faked.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
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