Skip to content

Commit

Permalink
Code Review Feedback
Browse files Browse the repository at this point in the history
* Rename ComplianceReportViewSelector
  • Loading branch information
dhaselhan committed Dec 18, 2024
1 parent 9f529de commit 1e52ca9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions backend/lcfs/services/rabbitmq/report_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ async def handle_message(
)
user = await UserRepository(db=session).get_user_by_id(user_id)

if not user:
logger.error(f"Cannot parse Report {legacy_id} from TFRS, no user with ID {user_id}")

if action == "Created":
await self._handle_created(
org_id,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { AddEditAllocationAgreements } from './views/AllocationAgreements/AddEdi
import { logout } from '@/utils/keycloak.js'
import { CompareReports } from '@/views/CompareReports/CompareReports'
import { ViewLegacyComplianceReport } from '@/views/ComplianceReports/ViewLegacyComplianceReport.jsx'
import { ViewComplianceReportBrancher } from '@/views/ComplianceReports/ViewComplianceReportBrancher.jsx'
import { ComplianceReportViewSelector } from '@/views/ComplianceReports/ComplianceReportViewSelector.jsx'

const router = createBrowserRouter([
{
Expand Down Expand Up @@ -198,7 +198,7 @@ const router = createBrowserRouter([
},
{
path: ROUTES.REPORTS_VIEW,
element: <ViewComplianceReportBrancher />,
element: <ComplianceReportViewSelector />,
handle: { title: '' }
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ViewLegacyComplianceReport } from '@/views/ComplianceReports/ViewLegacy
import { useParams } from 'react-router-dom'
import { EditViewComplianceReport } from '@/views/ComplianceReports/EditViewComplianceReport.jsx'

export const ViewComplianceReportBrancher = () => {
export const ComplianceReportViewSelector = () => {
const { complianceReportId } = useParams()
const { data: currentUser, isLoading: isCurrentUserLoading } =
useCurrentUser()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { render, screen, waitFor } from '@testing-library/react'
import { describe, it, expect, beforeEach, vi } from 'vitest'
import { ViewComplianceReportBrancher } from '../ViewComplianceReportBrancher'
import { ComplianceReportViewSelector } from '../ComplianceReportViewSelector.jsx'
import * as useComplianceReportsHook from '@/hooks/useComplianceReports'
import * as useCurrentUserHook from '@/hooks/useCurrentUser'
import { wrapper } from '@/tests/utils/wrapper'
Expand Down Expand Up @@ -71,7 +71,7 @@ describe('ViewComplianceReportBrancher', () => {

it('renders loading when user is loading', async () => {
setupMocks({ isCurrentUserLoading: true })
render(<ViewComplianceReportBrancher />, { wrapper })
render(<ComplianceReportViewSelector />, { wrapper })

await waitFor(() => {
expect(screen.getByText('Loading...')).toBeInTheDocument()
Expand All @@ -80,7 +80,7 @@ describe('ViewComplianceReportBrancher', () => {

it('renders loading when report is loading', async () => {
setupMocks({ isReportLoading: true })
render(<ViewComplianceReportBrancher />, { wrapper })
render(<ComplianceReportViewSelector />, { wrapper })

await waitFor(() => {
expect(screen.getByText('Loading...')).toBeInTheDocument()
Expand All @@ -97,7 +97,7 @@ describe('ViewComplianceReportBrancher', () => {
}
})

render(<ViewComplianceReportBrancher />, { wrapper })
render(<ComplianceReportViewSelector />, { wrapper })

await waitFor(() => {
expect(screen.getByText('Legacy Report View')).toBeInTheDocument()
Expand All @@ -117,7 +117,7 @@ describe('ViewComplianceReportBrancher', () => {
}
})

render(<ViewComplianceReportBrancher />, { wrapper })
render(<ComplianceReportViewSelector />, { wrapper })

await waitFor(() => {
expect(screen.getByText('Edit Compliance Report')).toBeInTheDocument()
Expand All @@ -137,7 +137,7 @@ describe('ViewComplianceReportBrancher', () => {
}
})

render(<ViewComplianceReportBrancher />, { wrapper })
render(<ComplianceReportViewSelector />, { wrapper })

await waitFor(() => {
expect(screen.getByText('Edit Compliance Report')).toBeInTheDocument()
Expand Down

0 comments on commit 1e52ca9

Please sign in to comment.