Skip to content

Commit

Permalink
fix: success test
Browse files Browse the repository at this point in the history
  • Loading branch information
fmorency committed Nov 7, 2024
1 parent cdc8b98 commit 6461f5d
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions components/groups/forms/groups/__tests__/Success.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { describe, test, afterEach, expect, jest } from 'bun:test';
import React from 'react';
import { render, screen, cleanup } from '@testing-library/react';
import { screen, cleanup, getDefaultNormalizer } from '@testing-library/react';
import Success from '@/components/groups/forms/groups/Success';
import matchers from '@testing-library/jest-dom/matchers';
import { mockGroupFormData } from '@/tests/mock';
import { renderWithChainProvider } from '@/tests/render';

expect.extend(matchers);

Expand All @@ -16,20 +17,23 @@ describe('Success Component', () => {
afterEach(cleanup);

test('renders component with correct details', () => {
render(<Success {...mockProps} />);
renderWithChainProvider(<Success {...mockProps} />);
expect(screen.getByText('Success!')).toBeInTheDocument();
expect(
screen.getByText('Your transaction was successfully signed and broadcasted.')
).toBeInTheDocument();
expect(screen.getByText('Group Details')).toBeInTheDocument();
expect(screen.getByText(mockGroupFormData.title)).toBeInTheDocument();
expect(screen.getByText('Group Information')).toBeInTheDocument();
expect(screen.getByText('manifest1autho...author')).toBeInTheDocument();
expect(screen.getByText(mockGroupFormData.summary)).toBeInTheDocument();
expect(screen.getByText(mockGroupFormData.description)).toBeInTheDocument();
expect(screen.getByText(mockGroupFormData.forumLink)).toBeInTheDocument();
expect(screen.getByText('3600 seconds')).toBeInTheDocument();
expect(screen.getByText(mockGroupFormData.votingThreshold)).toBeInTheDocument();
expect(screen.getByText('manifest1efd63...m6rp3z')).toBeInTheDocument();
expect(screen.getByText('manifest1hj5fv...8ws9ct')).toBeInTheDocument();
const normalizer = getDefaultNormalizer({ collapseWhitespace: true, trim: true });
expect(screen.getByText('2 / 2', { normalizer })).toBeInTheDocument();
});

// TODO: Test for `Back to Groups Page` button
test('renders Back to Groups Page button', () => {
renderWithChainProvider(<Success {...mockProps} />);
const button = screen.getByText('Back to Groups Page');
expect(button).toBeInTheDocument();
expect(button).toBeEnabled();
});
});

0 comments on commit 6461f5d

Please sign in to comment.