Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Expand Up @@ -127,7 +127,7 @@ describe('ChargingSiteProfile', () => {
expect(screen.queryByRole('button', { name: setValidatedLabel })).not.toBeInTheDocument()
})

it('shows "Submit updates" when BCeID Compliance and status is Draft', () => {
it('does not show "Submit updates" when BCeID Compliance and status is Draft', () => {
const hasAnyRole = vi.fn((...roles) => roles.includes('Compliance Reporting'))
render(
<ChargingSiteProfile
Expand All @@ -139,6 +139,23 @@ describe('ChargingSiteProfile', () => {
/>,
{ wrapper }
)
expect(screen.queryByRole('button', { name: submitUpdatesLabel })).not.toBeInTheDocument()
expect(screen.queryByRole('button', { name: setValidatedLabel })).not.toBeInTheDocument()
})

it('shows "Submit updates" when BCeID Compliance and status is Updated', () => {
const hasAnyRole = vi.fn((...roles) => roles.includes('Compliance Reporting'))
const updatedData = { ...mockData, status: { status: 'Updated' } }
render(
<ChargingSiteProfile
data={updatedData}
hasAnyRole={hasAnyRole}
hasRoles={vi.fn(() => false)}
isIDIR={false}
refetch={vi.fn()}
/>,
{ wrapper }
)
expect(screen.getByRole('button', { name: submitUpdatesLabel })).toBeInTheDocument()
expect(screen.queryByRole('button', { name: setValidatedLabel })).not.toBeInTheDocument()
})
Expand Down Expand Up @@ -181,9 +198,10 @@ describe('ChargingSiteProfile', () => {

it('calls mutation with Submitted when "Submit updates" is clicked', () => {
const hasAnyRole = vi.fn((...roles) => roles.includes('Compliance Reporting'))
const updatedData = { ...mockData, status: { status: 'Updated' } }
render(
<ChargingSiteProfile
data={mockData}
data={updatedData}
hasAnyRole={hasAnyRole}
hasRoles={vi.fn(() => false)}
isIDIR={false}
Expand All @@ -198,4 +216,4 @@ describe('ChargingSiteProfile', () => {
)
})
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ export const ChargingSiteProfile = ({

// IDIR Analyst only: show "Set as validated" when site is Submitted (backend enforces Analyst)
const canSetValidated = isIDIR && isAnalyst && currentStatus === 'Submitted'
// BCeID: show "Submit updates" for Compliance Reporting/Signing Authority when Draft or Updated
const canSubmitSite =
!isIDIR && isBCeIDCompliance && (currentStatus === 'Draft' || currentStatus === 'Updated')
// BCeID: show "Submit updates" for Compliance Reporting/Signing Authority only when Updated
const canSubmitSite = !isIDIR && isBCeIDCompliance && currentStatus === 'Updated'

const handleSetValidated = () => {
if (!canSetValidated || !siteId) return
Expand Down
Loading