Files
Sauci/apps/mobile/src/__tests__/components/ReadReceipt.test.tsx
T
Jamie BruntonandClaude Code f7aa6ed8dd Add feature opt-ins, dashboard view, and tests
Introduce feature_interests schema + realtime publication and surface opt-in trends in the admin dashboard. Add Jest test infrastructure/coverage for the mobile app and update push-all to run mobile checks before pushing.

Co-authored-by: Claude Code <claude@anthropic.com>
2026-01-02 11:36:51 +00:00

30 lines
1.2 KiB
TypeScript

import React from 'react';
import { ReadReceipt, getReceiptStatus } from '@/components/ui/ReadReceipt';
import { render } from '@/test/test-utils';
describe('ReadReceipt', () => {
it('derives receipt status from timestamps', () => {
expect(getReceiptStatus(null, null)).toBe('sent');
expect(getReceiptStatus('2020-01-01T00:00:00.000Z', null)).toBe('delivered');
expect(getReceiptStatus('2020-01-01T00:00:00.000Z', '2020-01-01T00:00:00.000Z')).toBe('read');
expect(getReceiptStatus(null, '2020-01-01T00:00:00.000Z')).toBe('read');
});
it('renders correct icon name for sent', () => {
const { getByText } = render(<ReadReceipt status="sent" />);
expect(getByText('checkmark')).toBeTruthy();
});
it('renders correct icon name for delivered', () => {
const { getByText } = render(<ReadReceipt status="delivered" />);
const icon = getByText('checkmark-done');
expect(icon.props.color).toBeDefined();
});
it('renders correct icon name for read', () => {
const { getByText } = render(<ReadReceipt status="read" readColor="gold" />);
const icon = getByText('checkmark-done');
expect(icon.props.color).toBe('gold');
});
});