]>
git.r.bdr.sh - rbdr/forum/blob - src/components/topic_summary/topic_summary.test.js
1 import '@testing-library/jest-dom/extend-expect';
3 import { render
} from '@testing-library/svelte';
4 import '$/config/i18n';
6 import TopicSummary
from './topic_summary.svelte';
12 describe('Topic Summary component', () => {
16 internals
.results
= render(TopicSummary
, { props: {
18 id: 'ea2431c8-5c1c-4ed0-907a-45e012696ab8',
19 title: 'I sure am a test topic',
21 updated_at: Date
.now()
26 test('It should display the title', () => {
28 expect(internals
.results
.getByText('I sure am a test topic'))
32 test('Topic title should be a permalink', () => {
34 expect(internals
.results
.getByText('I sure am a test topic').closest('a'))
35 .toHaveAttribute('href', '/t/ea2431c8-5c1c-4ed0-907a-45e012696ab8');
38 test('It should display remaining time in readable format', () => {
40 expect(internals
.results
.getByText(/2 minutes remaining
/))