From 1ef295c1404a3f987add1dbb6c782e0ef4c4dc9a Mon Sep 17 00:00:00 2001 From: Alejandro Sanchez Date: Tue, 30 Apr 2024 21:41:50 -0700 Subject: [PATCH] Test updates --- .../AddLeaseContainer.test.tsx.snap | 5 - .../details/PropertyInformation.test.tsx | 12 +- .../details/PropertyInformation.tsx | 6 +- .../PropertiesInformation.test.tsx.snap | 94 ++++- .../PropertyInformation.test.tsx.snap | 344 ++++++++++++++++-- .../SelectedPropertyRow.test.tsx | 3 +- .../SelectedPropertyRow.test.tsx.snap | 164 +++++++-- 7 files changed, 543 insertions(+), 85 deletions(-) diff --git a/source/frontend/src/features/leases/add/__snapshots__/AddLeaseContainer.test.tsx.snap b/source/frontend/src/features/leases/add/__snapshots__/AddLeaseContainer.test.tsx.snap index b7268d9514..69aeed5a1b 100644 --- a/source/frontend/src/features/leases/add/__snapshots__/AddLeaseContainer.test.tsx.snap +++ b/source/frontend/src/features/leases/add/__snapshots__/AddLeaseContainer.test.tsx.snap @@ -1343,11 +1343,6 @@ exports[`AddLeaseContainer component > renders as expected 1`] = ` -
- Area included -
No Properties selected diff --git a/source/frontend/src/features/leases/detail/LeasePages/details/PropertyInformation.test.tsx b/source/frontend/src/features/leases/detail/LeasePages/details/PropertyInformation.test.tsx index 16c0a388e0..aff3c25455 100644 --- a/source/frontend/src/features/leases/detail/LeasePages/details/PropertyInformation.test.tsx +++ b/source/frontend/src/features/leases/detail/LeasePages/details/PropertyInformation.test.tsx @@ -3,10 +3,10 @@ import { createMemoryHistory } from 'history'; import noop from 'lodash/noop'; import { mockApiProperty } from '@/mocks/filterData.mock'; +import { getMockApiLease } from '@/mocks/lease.mock'; import { getEmptyPropertyLease } from '@/mocks/properties.mock'; import { ApiGen_Concepts_Lease } from '@/models/api/generated/ApiGen_Concepts_Lease'; import { toTypeCodeNullable } from '@/utils/formUtils'; -import { getMockApiLease } from '@/mocks/lease.mock'; import { render, RenderOptions } from '@/utils/test-utils'; import PropertyInformation, { IPropertyInformationProps } from './PropertyInformation'; @@ -45,7 +45,7 @@ describe('PropertyInformation component', () => { fileProperties: [ { ...getEmptyPropertyLease(), - ...mockApiProperty, + property: { ...mockApiProperty }, areaUnitType: toTypeCodeNullable('test'), leaseArea: 123, fileId: 0, @@ -65,7 +65,7 @@ describe('PropertyInformation component', () => { fileProperties: [ { ...getEmptyPropertyLease(), - ...mockApiProperty, + property: { ...mockApiProperty }, areaUnitType: toTypeCodeNullable('test'), leaseArea: 123, fileId: 0, @@ -94,7 +94,7 @@ describe('PropertyInformation component', () => { fileProperties: [ { ...getEmptyPropertyLease(), - ...mockApiProperty, + property: { ...mockApiProperty }, leaseArea: 1, areaUnitType: toTypeCodeNullable('test'), fileId: 0, @@ -123,7 +123,7 @@ describe('PropertyInformation component', () => { fileProperties: [ { ...getEmptyPropertyLease(), - ...mockApiProperty, + property: { ...mockApiProperty }, leaseArea: 123, areaUnitType: null, fileId: 0, @@ -141,7 +141,7 @@ describe('PropertyInformation component', () => { startDate: '2020-01-01', }, }); - expect(component.getByText(/123.00/i)).toBeVisible(); + expect(component.getByText(/123/i)).toBeVisible(); expect(component.queryByDisplayValue('undefined')).toBeNull(); }); }); diff --git a/source/frontend/src/features/leases/detail/LeasePages/details/PropertyInformation.tsx b/source/frontend/src/features/leases/detail/LeasePages/details/PropertyInformation.tsx index 0cfc410fa6..40e1387dfd 100644 --- a/source/frontend/src/features/leases/detail/LeasePages/details/PropertyInformation.tsx +++ b/source/frontend/src/features/leases/detail/LeasePages/details/PropertyInformation.tsx @@ -4,6 +4,7 @@ import styled from 'styled-components'; import { Input } from '@/components/common/form'; import { SectionField } from '@/components/common/Section/SectionField'; import AreaContainer from '@/components/measurements/AreaContainer'; +import { AreaUnitTypes } from '@/constants'; import { ApiGen_Base_CodeType } from '@/models/api/generated/ApiGen_Base_CodeType'; import { ApiGen_Concepts_Lease } from '@/models/api/generated/ApiGen_Concepts_Lease'; import { isValidId, pidFormatter } from '@/utils'; @@ -49,7 +50,10 @@ export const PropertyInformation: React.FunctionComponent< - + {!hideAddress ? ( diff --git a/source/frontend/src/features/leases/detail/LeasePages/details/__snapshots__/PropertiesInformation.test.tsx.snap b/source/frontend/src/features/leases/detail/LeasePages/details/__snapshots__/PropertiesInformation.test.tsx.snap index bd28bcc437..e621eb37bd 100644 --- a/source/frontend/src/features/leases/detail/LeasePages/details/__snapshots__/PropertiesInformation.test.tsx.snap +++ b/source/frontend/src/features/leases/detail/LeasePages/details/__snapshots__/PropertiesInformation.test.tsx.snap @@ -36,6 +36,20 @@ exports[`PropertiesInformation component > renders as expected 1`] = ` font-weight: bold; } +.c6 { + max-width: 25rem; + padding: 1rem; + border: 1px solid; + border-radius: 0.5rem; +} + +.c7 { + max-width: 25rem; + padding: 1rem; + border: 1px solid; + border-radius: 0.5rem; +} + .c3 { margin-top: 4rem; } @@ -145,10 +159,82 @@ exports[`PropertiesInformation component > renders as expected 1`] = `
- 123.00 m - - 2 - +
+
+
+
+
+ 123 +
+
+ sq. metres +
+
+
+
+ 0.01 +
+
+ hectares +
+
+
+
+
+
+
+
+ 1,323.96 +
+
+ sq. feet +
+
+
+
+ 0.03 +
+
+ acres +
+
+
+
+
renders a complete lease as expected 1` } .c3 { - grid-column: controls; - border-left: 1px solid black !important; - padding: 0.6rem 1.2rem; - color: #495057; - font-family: 'BCSans-Bold'; + max-width: 25rem; + padding: 1rem; + border: 1px solid; + border-radius: 0.5rem; +} + +.c4 { + max-width: 25rem; + padding: 1rem; + border: 1px solid; + border-radius: 0.5rem; } .c0 { @@ -90,10 +96,82 @@ exports[`PropertyInformation component > renders a complete lease as expected 1`
- 123.00 m - - 2 - +
+
+
+
+
+ 123 +
+
+ sq. metres +
+
+
+
+ 0.01 +
+
+ hectares +
+
+
+
+
+
+
+
+ 1,323.96 +
+
+ sq. feet +
+
+
+
+ 0.03 +
+
+ acres +
+
+
+
+
renders a complete lease as expected 1`
- -

+

+
- Address not available in PIMS -

+ +
+
+ +
+
+ +
+
+ +
+
+ +
renders a complete lease as expected 1`
+ > + test description +

@@ -162,11 +298,17 @@ exports[`PropertyInformation component > renders minimally as expected 1`] = ` } .c3 { - grid-column: controls; - border-left: 1px solid black !important; - padding: 0.6rem 1.2rem; - color: #495057; - font-family: 'BCSans-Bold'; + max-width: 25rem; + padding: 1rem; + border: 1px solid; + border-radius: 0.5rem; +} + +.c4 { + max-width: 25rem; + padding: 1rem; + border: 1px solid; + border-radius: 0.5rem; } .c0 { @@ -234,10 +376,82 @@ exports[`PropertyInformation component > renders minimally as expected 1`] = `
- 123.00 m - - 2 - +
+
+
+
+
+ 123 +
+
+ sq. metres +
+
+
+
+ 0.01 +
+
+ hectares +
+
+
+
+
+
+
+
+ 1,323.96 +
+
+ sq. feet +
+
+
+
+ 0.03 +
+
+ acres +
+
+
+
+
renders minimally as expected 1`] = `
- -

+

+
- Address not available in PIMS -

+ +
+
+ +
+
+ +
+
+ +
+
+ +
renders minimally as expected 1`] = `
+ > + test description +

diff --git a/source/frontend/src/features/leases/shared/propertyPicker/selectedPropertyList/SelectedPropertyRow.test.tsx b/source/frontend/src/features/leases/shared/propertyPicker/selectedPropertyList/SelectedPropertyRow.test.tsx index 21122db275..10b658f8d6 100644 --- a/source/frontend/src/features/leases/shared/propertyPicker/selectedPropertyList/SelectedPropertyRow.test.tsx +++ b/source/frontend/src/features/leases/shared/propertyPicker/selectedPropertyList/SelectedPropertyRow.test.tsx @@ -25,8 +25,9 @@ describe('SelectedPropertyRow component', () => { // render component under test const component = await renderAsync( - {() => ( + {formikProps => ( renders as expected 1`] = ` }
renders as expected 1`] = ` />
renders as expected 1`] = `
-
-
-
- -
-
-
- m - - 2 - -
-
-
-
+ .c0 { + max-width: 25rem; + padding: 1rem; + border: 1px solid; + border-radius: 0.5rem; +} + +.c2 { + max-width: 25rem; + padding: 1rem; + border: 1px solid; + border-radius: 0.5rem; +} + +.c1 { + max-width: 9rem; +} + +
+
+
+
+
+
+
+ +
+
+ sq. metres +
+
+
+
+ +
+
+ hectares +
+
+
+
+
+
+
+
+ +
+
+ sq. feet +
+
+
+
+ +
+
+ acres +
+
+
+
+
+
+
`;