Skip to content

Commit

Permalink
Update TableRow
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunalpal216 committed Nov 9, 2024
1 parent f45282f commit 65ab361
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/components/CheckIn/TableRow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ describe('Testing Table Row for CheckIn Table', () => {
fireEvent.click(await findByText('Download Tag'));

expect(
await findByText(
'Error generating pdf: Template or inputs cannot be empty.',
),
await findByText('Error generating pdf: Invalid or empty name provided'),
).toBeInTheDocument();
});
});
5 changes: 3 additions & 2 deletions src/components/CheckIn/TableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ export const TableRow = ({
const generateTag = async (): Promise<void> => {
try {
const inputs = [];
if (data.name) {
inputs.push({ name: data.name });
if (typeof data.name !== 'string' || !data.name.trim()) {
throw new Error('Invalid or empty name provided');
}
inputs.push({ name: data.name.trim() });
const pdf = await generate({ template: tagTemplate, inputs });
// istanbul ignore next
const blob = new Blob([pdf.buffer], { type: 'application/pdf' });
Expand Down

0 comments on commit 65ab361

Please sign in to comment.