2 * @jest-environment jsdom
5 import '@testing-library/jest-dom/extend-expect';
7 import { render } from '@testing-library/svelte';
10 import TopicSummary from './topic_summary.svelte';
16 describe('Topic Summary component', () => {
18 internals.results = render(TopicSummary, {
21 id: 'ea2431c8-5c1c-4ed0-907a-45e012696ab8',
22 title: 'I sure am a test topic',
24 updated_at: Date.now()
30 test('It should display the title', () => {
31 expect(internals.results.getByText('I sure am a test topic')).toBeVisible();
34 test('Topic title should be a permalink', () => {
35 expect(internals.results.getByText('I sure am a test topic').closest('a')).toHaveAttribute(
37 '/t/ea2431c8-5c1c-4ed0-907a-45e012696ab8'
41 test('It should display remaining time in readable format', () => {
42 expect(internals.results.getByText(/2 minutes remaining/)).toBeVisible();