Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { render, screen } from '@testing-library/react'
import { screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { describe, test, expect, vi, beforeEach } from 'vitest'
import { ManageSignatories } from './ManageSignatories'
import { useDocumentList } from './useDocumentList'
import { GustoTestProvider } from '@/test/GustoTestApiProvider'
import { renderWithProviders } from '@/test-utils/renderWithProviders'
vi.mock('./useDocumentList')

Expand Down Expand Up @@ -35,9 +34,9 @@ describe('ManageSignatories', () => {

renderWithProviders(<ManageSignatories />)

expect(screen.getByRole('heading')).toHaveTextContent('otherSignatoryTitle')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some changes to our translation provider and now these keys render as a by product.

expect(screen.getByRole('paragraph')).toHaveTextContent('noSignatorySubtext')
expect(screen.getByRole('button')).toHaveTextContent('assignSignatoryCta')
expect(screen.getByRole('heading')).toHaveTextContent('Only the signatory can sign documents.')
expect(screen.getByRole('paragraph')).toHaveTextContent('A signatory has not yet been assigned')
expect(screen.getByRole('button')).toHaveTextContent('Assign signatory')
})

test('when user is the signatory', () => {
Expand All @@ -52,15 +51,13 @@ describe('ManageSignatories', () => {
},
})

render(
<GustoTestProvider>
<ManageSignatories />
</GustoTestProvider>,
)
renderWithProviders(<ManageSignatories />)

expect(screen.getByRole('heading')).toHaveTextContent('selfSignatoryTitle')
expect(screen.getByRole('paragraph')).toHaveTextContent('selfSignatorySubtext')
expect(screen.getByRole('button')).toHaveTextContent('changeSignatoryCta')
expect(screen.getByRole('heading')).toHaveTextContent(
'Please note, only the signatory can sign documents.',
)
expect(screen.getByRole('paragraph')).toHaveTextContent('You are the assigned signatory.')
expect(screen.getByRole('button')).toHaveTextContent('Change signatory')
})

test('when another user is the signatory', () => {
Expand All @@ -75,15 +72,11 @@ describe('ManageSignatories', () => {
},
})

render(
<GustoTestProvider>
<ManageSignatories />
</GustoTestProvider>,
)
renderWithProviders(<ManageSignatories />)

expect(screen.getByRole('heading')).toHaveTextContent('otherSignatoryTitle')
expect(screen.getByRole('paragraph')).toHaveTextContent('otherSignatorySubtext')
expect(screen.getByRole('button')).toHaveTextContent('changeSignatoryCta')
expect(screen.getByRole('heading')).toHaveTextContent('Only the signatory can sign documents.')
expect(screen.getByRole('paragraph')).toHaveTextContent('Your signatory is Jane Smith, CEO.')
expect(screen.getByRole('button')).toHaveTextContent('Change signatory')
})

test('handles change signatory button click', async () => {
Expand All @@ -92,11 +85,7 @@ describe('ManageSignatories', () => {
handleChangeSignatory: mockHandleChangeSignatory,
})

render(
<GustoTestProvider>
<ManageSignatories />
</GustoTestProvider>,
)
renderWithProviders(<ManageSignatories />)

await userEvent.click(screen.getByRole('button'))
expect(mockHandleChangeSignatory).toHaveBeenCalledTimes(1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { action } from '@ladle/react'
import { PayrollHistoryPresentation } from './PayrollHistoryPresentation'
import type { PayrollHistoryItem } from './PayrollHistoryPresentation'
import type { PayrollHistoryItem } from './PayrollHistory'

export default {
title: 'Domain/Payroll/PayrollHistory',
Expand All @@ -26,7 +26,7 @@ const mockPayrollHistory: PayrollHistoryItem[] = [
{
id: '3',
payPeriod: 'Aug 27 – Sep 10, 2025',
type: 'Dismissal',
type: 'External',
payDate: 'Nov 24, 2024',
status: 'Complete',
amount: 30842.99,
Expand Down
Loading