Skip to content

Commit 486a86f

Browse files
committed
chore: Update tests
1 parent ef65abb commit 486a86f

3 files changed

Lines changed: 11 additions & 14 deletions

File tree

admin/frontend/test/pages/rec-resource-page/components/RecResourceAssetsSection/AssetCard.test.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ describe('AssetCard', () => {
129129
it('shows a dash for every field with no value', () => {
130130
render(<AssetCard asset={buildAsset()} repairCodes={[]} />);
131131

132-
expect(screen.getAllByText('')).toHaveLength(7);
132+
expect(screen.getAllByText('-')).toHaveLength(7);
133133
});
134134

135135
it('shows a dash for repair spend and outstanding estimate when there are no repairs', () => {
@@ -140,7 +140,7 @@ describe('AssetCard', () => {
140140
/>,
141141
);
142142

143-
expect(screen.getAllByText('')).toHaveLength(7);
143+
expect(screen.getAllByText('-')).toHaveLength(7);
144144
});
145145

146146
it('shows a dash for location when only one of latitude/longitude is set', () => {
@@ -153,7 +153,7 @@ describe('AssetCard', () => {
153153

154154
expect(screen.getByText('Location:')).toBeInTheDocument();
155155
expect(screen.queryByText(/^49\.1/)).not.toBeInTheDocument();
156-
expect(screen.getAllByText('')).toHaveLength(7);
156+
expect(screen.getAllByText('-')).toHaveLength(7);
157157
});
158158

159159
it('excludes repairs with no completion date from repair spend', () => {
@@ -171,7 +171,10 @@ describe('AssetCard', () => {
171171
/>,
172172
);
173173

174-
expect(screen.getByText('$0')).toBeInTheDocument();
174+
const repairSpendField = screen
175+
.getByText('Repair spend:')
176+
.closest('.asset-card__field');
177+
expect(repairSpendField).toHaveTextContent('$0');
175178
});
176179

177180
it('falls back to estimated cost when a completed repair has no actual cost', () => {

admin/frontend/test/pages/rec-resource-page/components/RecResourceAssetsSection/RecResourceAssetsSection.test.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ describe('RecResourceAssetsSection', () => {
123123

124124
render(<RecResourceAssetsSection />);
125125

126-
expect(screen.getByText('Assets')).toBeInTheDocument();
126+
expect(
127+
screen.getByRole('heading', { name: 'Assets', level: 2 }),
128+
).toBeInTheDocument();
127129
expect(screen.getByText('Total value')).toBeInTheDocument();
128130
});
129131

@@ -230,12 +232,4 @@ describe('RecResourceAssetsSection', () => {
230232

231233
expect(screen.queryByText('Repair details')).not.toBeInTheDocument();
232234
});
233-
234-
it('renders the Add campsite button', () => {
235-
render(<RecResourceAssetsSection />);
236-
237-
expect(
238-
screen.getByRole('button', { name: /Add campsite/ }),
239-
).toBeInTheDocument();
240-
});
241235
});

admin/frontend/test/services/hooks/recreation-resource-admin/useGetAssetsByRecResourceId.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('useGetAssetsByRecResourceId', () => {
5959
expect(mockGetPaginatedRecreationAssets).toHaveBeenCalledWith({
6060
recResourceId: 'REC123',
6161
page: 1,
62-
limit: 50,
62+
limit: 500,
6363
includeRepair: true,
6464
});
6565
});

0 commit comments

Comments
 (0)