Skip to content

Commit b7bb5c3

Browse files
committed
cleanup
1 parent b537ffc commit b7bb5c3

File tree

2 files changed

+14
-162
lines changed

2 files changed

+14
-162
lines changed

frontend/src/__tests__/components/molecules/PreviewTemplateDetails.test.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,16 +203,10 @@ describe('PreviewTemplateDetailsLetter', () => {
203203
});
204204

205205
it('If the template is client-owned, the clientId is used to construct download link', () => {
206-
const container = render(
206+
const { getByTestId } = render(
207207
<PreviewTemplateDetailsLetter
208208
template={{
209-
id: 'template-id',
210-
owner: 'CLIENT#client',
211-
name: 'Example letter',
212-
templateStatus: 'PROOF_AVAILABLE',
213-
templateType: 'LETTER',
214-
letterType: 'x0',
215-
language: 'en',
209+
createdAt: '2025-01-13T10:19:25.579Z',
216210
files: {
217211
pdfTemplate: {
218212
fileName: 'file.pdf',
@@ -227,12 +221,22 @@ describe('PreviewTemplateDetailsLetter', () => {
227221
},
228222
},
229223
},
230-
createdAt: '2025-01-13T10:19:25.579Z',
224+
id: 'template-id',
225+
language: 'en',
226+
letterType: 'x0',
227+
name: 'Example letter',
228+
owner: 'CLIENT#client',
229+
templateStatus: 'PROOF_AVAILABLE',
230+
templateType: 'LETTER',
231231
updatedAt: '2025-01-13T10:19:25.579Z',
232232
}}
233233
/>
234234
);
235235

236-
expect(container.asFragment()).toMatchSnapshot();
236+
const link = getByTestId('proof-link_a.pdf');
237+
expect(link).toHaveAttribute(
238+
'href',
239+
'/templates/files/client/proofs/template-id/a.pdf'
240+
);
237241
});
238242
});

frontend/src/__tests__/components/molecules/__snapshots__/PreviewTemplateDetails.test.tsx.snap

Lines changed: 0 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -119,158 +119,6 @@ exports[`PreviewTemplateDetailsEmail matches snapshot 1`] = `
119119
</DocumentFragment>
120120
`;
121121

122-
exports[`PreviewTemplateDetailsLetter If the template is client-owned, the clientId is used to construct download link 1`] = `
123-
<DocumentFragment>
124-
<h1
125-
class="preview__heading"
126-
data-testid="preview-message__heading"
127-
>
128-
Example letter
129-
</h1>
130-
<div
131-
class="nhsuk-width-container nhsuk-u-margin-bottom-6 nhsuk-body-m"
132-
>
133-
<dl
134-
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
135-
>
136-
<div
137-
class="nhsuk-summary-list__row"
138-
>
139-
<dt
140-
class="nhsuk-summary-list__key"
141-
>
142-
Template ID
143-
</dt>
144-
<dd
145-
class="nhsuk-summary-list__value"
146-
>
147-
template-id
148-
</dd>
149-
</div>
150-
<div
151-
class="nhsuk-summary-list__row"
152-
>
153-
<dt
154-
class="nhsuk-summary-list__key"
155-
>
156-
Type
157-
</dt>
158-
<dd
159-
class="nhsuk-summary-list__value"
160-
>
161-
Standard letter
162-
</dd>
163-
</div>
164-
<div
165-
class="nhsuk-summary-list__row"
166-
>
167-
<dt
168-
class="nhsuk-summary-list__key"
169-
>
170-
Status
171-
</dt>
172-
<dd
173-
class="nhsuk-summary-list__value"
174-
>
175-
<strong
176-
class="nhsuk-tag nhsuk-tag--orange"
177-
>
178-
Proof available
179-
</strong>
180-
</dd>
181-
</div>
182-
<div
183-
class="nhsuk-summary-list__row"
184-
>
185-
<dt
186-
class="nhsuk-summary-list__key"
187-
>
188-
Template file
189-
</dt>
190-
<dd
191-
class="nhsuk-summary-list__value"
192-
>
193-
<div
194-
class="container"
195-
>
196-
<svg
197-
class="icon"
198-
fill="none"
199-
height="26"
200-
viewBox="0 0 20 26"
201-
width="20"
202-
xmlns="http://www.w3.org/2000/svg"
203-
>
204-
<path
205-
d="M0 0V26H20V6.59375L19.7188 6.28125L13.7188 0.28125L13.4062 0H0ZM2 2H12V8H18V24H2V2ZM14 3.4375L16.5625 6H14V3.4375Z"
206-
fill="#4C6272"
207-
/>
208-
</svg>
209-
<p
210-
class="text"
211-
>
212-
file.pdf
213-
</p>
214-
</div>
215-
</dd>
216-
</div>
217-
</dl>
218-
<dl
219-
class="nhsuk-summary-list nhsuk-u-margin-bottom-4 preview"
220-
>
221-
<div
222-
class="nhsuk-summary-list__row"
223-
>
224-
<dt
225-
class="nhsuk-summary-list__key"
226-
>
227-
Template proof files
228-
</dt>
229-
<dd
230-
class="nhsuk-summary-list__value"
231-
>
232-
<ul
233-
class="proofs"
234-
>
235-
<li>
236-
<a
237-
data-testid="proof-link_a.pdf"
238-
href="/templates/files/client/proofs/template-id/a.pdf"
239-
rel="noopener noreferrer"
240-
target="_blank"
241-
>
242-
<div
243-
class="container"
244-
>
245-
<svg
246-
class="icon"
247-
fill="none"
248-
height="26"
249-
viewBox="0 0 20 26"
250-
width="20"
251-
xmlns="http://www.w3.org/2000/svg"
252-
>
253-
<path
254-
d="M0 0V26H20V6.59375L19.7188 6.28125L13.7188 0.28125L13.4062 0H0ZM2 2H12V8H18V24H2V2ZM14 3.4375L16.5625 6H14V3.4375Z"
255-
fill="#4C6272"
256-
/>
257-
</svg>
258-
<p
259-
class="text"
260-
>
261-
a.pdf
262-
</p>
263-
</div>
264-
</a>
265-
</li>
266-
</ul>
267-
</dd>
268-
</div>
269-
</dl>
270-
</div>
271-
</DocumentFragment>
272-
`;
273-
274122
exports[`PreviewTemplateDetailsLetter if status is PROOF_AVAILABLE, but no proofs are registered on the template, proof section is hidden (this is unexpected) 1`] = `
275123
<DocumentFragment>
276124
<h1

0 commit comments

Comments
 (0)