-
- beforeAll(() => {
-
- addMessages('en', {
- 'test_forums.diversion': 'Diversion'
- });
- });
-
- beforeEach(() => {
-
- internals.results = render(Topic, { props: {
- topic: internals.basicTopic
- } });
- });
-
- test('Should show the topic title', () => {
-
- expect(internals.results.getByText('I sure am a test topic'))
- .toBeVisible();
- });
- test('Should display remaining time in readable format', () => {
-
- expect(internals.results.getByText(/2 minutes remaining/))
- .toBeVisible();
- });
- test('Remaining time should be a permalink to the topic', () => {
-
- expect(internals.results.getByText(/2 minutes remaining/).closest('a'))
- .toHaveAttribute('href', '/t/b1a4f8d1-4d16-4872-b391-fda6a0e9012d');
- });
-
- test('Should show text for all posts', () => {
-
- expect(internals.results.getByText('This is the first post'))
- .toBeVisible();
- expect(internals.results.getByText('This response came later'))
- .toBeVisible();
- });
-
- test('Should send index and count to posts', () => {
-
- expect(internals.results.getByTitle('Post 1 of 2 by past_user'))
- .toBeVisible();
- expect(internals.results.getByTitle('Post 2 of 2 by future_user'))
- .toBeVisible();
- });
-
- describe('Forum link', () => {
-
- test('Should show forum if the post has one', () => {
-
- expect(internals.results.getByText(/^\s*⏃\s*Diversion\s*$/))
- .toBeVisible();
- });
-
- test('Forum text should be a permalink to the forum', () => {
-
- expect(internals.results.getByText(/^\s*⏃\s*Diversion\s*$/).closest('a'))
- .toHaveAttribute('href', '/f/diversion');
- });
-
- test('Should not show forum if the post doesn\'t have one', () => {
-
- cleanup();
- internals.results = render(Topic, { props: {
- topic: internals.topicWithoutForum
- } });
-
- expect(internals.results.queryByText(/^\s*⏃\s*Diversion\s*$/))
- .toBe(null);
- });
- });
-
- describe('Tag listing', () => {
-
- test('Should show topic tags', () => {
-
- expect(internals.results.getByText('fish'))
- .toBeVisible();
- expect(internals.results.getByText('fish'))
- .toHaveTextContent('fish(40)');
- expect(internals.results.getByText('statue'))
- .toBeVisible();
- expect(internals.results.getByText('statue'))
- .toHaveTextContent('statue(5)');
- });
-
- test('Tag text should be a permalink to the tag', () => {
-
- expect(internals.results.getByText('fish').closest('a'))
- .toHaveAttribute('href', '/g/fish');
- expect(internals.results.getByText('statue').closest('a'))
- .toHaveAttribute('href', '/g/statue');
- });
- });
+ beforeAll(() => {
+ addMessages('en', {
+ 'test_forums.diversion': 'Diversion'
+ });
+ });
+
+ beforeEach(() => {
+ internals.results = render(Topic, {
+ props: {
+ topic: internals.basicTopic
+ }
+ });
+ });
+
+ test('Should show the topic title', () => {
+ expect(internals.results.getByText('I sure am a test topic')).toBeVisible();
+ });
+ test('Should display remaining time in readable format', () => {
+ expect(internals.results.getByText(/2 minutes remaining/)).toBeVisible();
+ });
+ test('Remaining time should be a permalink to the topic', () => {
+ expect(internals.results.getByText(/2 minutes remaining/).closest('a')).toHaveAttribute(
+ 'href',
+ '/t/b1a4f8d1-4d16-4872-b391-fda6a0e9012d'
+ );
+ });
+
+ test('Should show text for all posts', () => {
+ expect(internals.results.getByText('This is the first post')).toBeVisible();
+ expect(internals.results.getByText('This response came later')).toBeVisible();
+ });
+
+ test('Should send index and count to posts', () => {
+ expect(internals.results.getByTitle('Post 1 of 2 by past_user')).toBeVisible();
+ expect(internals.results.getByTitle('Post 2 of 2 by future_user')).toBeVisible();
+ });
+
+ describe('Forum link', () => {
+ test('Should show forum if the post has one', () => {
+ expect(internals.results.getByText(/^\s*⏃\s*Diversion\s*$/)).toBeVisible();
+ });
+
+ test('Forum text should be a permalink to the forum', () => {
+ expect(internals.results.getByText(/^\s*⏃\s*Diversion\s*$/).closest('a')).toHaveAttribute(
+ 'href',
+ '/f/diversion'
+ );
+ });
+
+ test("Should not show forum if the post doesn't have one", () => {
+ cleanup();
+ internals.results = render(Topic, {
+ props: {
+ topic: internals.topicWithoutForum
+ }
+ });
+
+ expect(internals.results.queryByText(/^\s*⏃\s*Diversion\s*$/)).toBe(null);
+ });
+ });
+
+ describe('Tag listing', () => {
+ test('Should show topic tags', () => {
+ expect(internals.results.getByText('fish')).toBeVisible();
+ expect(internals.results.getByText('fish')).toHaveTextContent('fish(40)');
+ expect(internals.results.getByText('statue')).toBeVisible();
+ expect(internals.results.getByText('statue')).toHaveTextContent('statue(5)');
+ });
+
+ test('Tag text should be a permalink to the tag', () => {
+ expect(internals.results.getByText('fish').closest('a')).toHaveAttribute('href', '/g/fish');
+ expect(internals.results.getByText('statue').closest('a')).toHaveAttribute(
+ 'href',
+ '/g/statue'
+ );
+ });
+ });