PHP Classes

File: tests/unit/components/CapsuleItem.test.tsx

Recommend this page to a friend!
  Classes of Maniruzzaman Akash   Maniruzzaman WordPress Frontend Editor   tests/unit/components/CapsuleItem.test.tsx   Download  
File: tests/unit/components/CapsuleItem.test.tsx
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Maniruzzaman WordPress Frontend Editor
WordPress plugin for visual front-end development
Author: By
Last change:
Date: 8 months ago
Size: 1,242 bytes
 

Contents

Class file image Download
import { render } from '@testing-library/react'; import CapsuleItem from '../../../src/components/capsule/CapsuleItem'; import { ICapsule } from '../../../src/interfaces'; const capsule: ICapsule = { capsule_serial: 'C101', capsule_id: 'dragon01', type: 'Dragon 1.0', status: 'active', original_launch: '2010-12-08T00:00:00.000Z', landings: 5, missions: [ { name: 'FalconSat-2', flight: 1 }, { name: 'COTS 1', flight: 2 } ], details: 'This is a test capsule' }; describe('CapsuleItem', () => { it('renders without crashing', () => { const { container } = render(<CapsuleItem capsule={capsule} isShortView={false} />); expect(container).toBeDefined(); }); it('hides details and missions when isShortView is true', () => { const { queryByText } = render(<CapsuleItem capsule={capsule} isShortView={true} />); expect(queryByText(/Missions/i)).toBeNull(); expect(queryByText(/Details/i)).toBeNull(); expect(queryByText('#C102')).toBeDefined(); expect(queryByText(/Dragon 2.0/i)).toBeDefined(); expect(queryByText(/Landed/i)).toBeDefined(); }); });