Skip to content

Commit

Permalink
Test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
asanchezr committed May 1, 2024
1 parent 2963685 commit 1ef295c
Show file tree
Hide file tree
Showing 7 changed files with 543 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1343,11 +1343,6 @@ exports[`AddLeaseContainer component > renders as expected 1`] = `
</svg>
</span>
</div>
<div
class="col-3"
>
Area included
</div>
</div>
<span>
No Properties selected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -45,7 +45,7 @@ describe('PropertyInformation component', () => {
fileProperties: [
{
...getEmptyPropertyLease(),
...mockApiProperty,
property: { ...mockApiProperty },
areaUnitType: toTypeCodeNullable('test'),
leaseArea: 123,
fileId: 0,
Expand All @@ -65,7 +65,7 @@ describe('PropertyInformation component', () => {
fileProperties: [
{
...getEmptyPropertyLease(),
...mockApiProperty,
property: { ...mockApiProperty },
areaUnitType: toTypeCodeNullable('test'),
leaseArea: 123,
fileId: 0,
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('PropertyInformation component', () => {
fileProperties: [
{
...getEmptyPropertyLease(),
...mockApiProperty,
property: { ...mockApiProperty },
leaseArea: 1,
areaUnitType: toTypeCodeNullable('test'),
fileId: 0,
Expand Down Expand Up @@ -123,7 +123,7 @@ describe('PropertyInformation component', () => {
fileProperties: [
{
...getEmptyPropertyLease(),
...mockApiProperty,
property: { ...mockApiProperty },
leaseArea: 123,
areaUnitType: null,
fileId: 0,
Expand All @@ -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();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -49,7 +50,10 @@ export const PropertyInformation: React.FunctionComponent<
<Input disabled={disabled} field={withNameSpace(nameSpace, 'propertyName')} />
</SectionField>
<SectionField label="Area included" labelWidth="3">
<AreaContainer landArea={landArea} unitCode={areaUnitType?.id} />
<AreaContainer
landArea={landArea}
unitCode={areaUnitType?.id ?? AreaUnitTypes.SquareMeters}
/>
</SectionField>
{!hideAddress ? (
<SectionField label="Address" labelWidth="3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -145,10 +159,82 @@ exports[`PropertiesInformation component > renders as expected 1`] = `
<div
class="c5 text-left col"
>
123.00 m
<sup>
2
</sup>
<div
class="row"
>
<div
class="col"
>
<div
class="c6"
>
<div
class="row"
>
<div
class="text-right col"
>
123
</div>
<div
class="col"
>
sq. metres
</div>
</div>
<div
class="row"
>
<div
class="text-right col"
>
0.01
</div>
<div
class="col"
>
hectares
</div>
</div>
</div>
</div>
<div
class="col"
>
<div
class="c7"
>
<div
class="row"
>
<div
class="text-right col"
>
1,323.96
</div>
<div
class="col"
>
sq. feet
</div>
</div>
<div
class="row"
>
<div
class="text-right col"
>
0.03
</div>
<div
class="col"
>
acres
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
Expand Down
Loading

0 comments on commit 1ef295c

Please sign in to comment.