From ff3caf107ed0898f3fd04e85f5b2eee58f4d7fe5 Mon Sep 17 00:00:00 2001 From: Rijul Poudel Date: Fri, 24 Jul 2026 14:44:27 -0500 Subject: [PATCH 1/2] [test]: hide base tables without attachments --- .../WbPlanView/__tests__/Components.test.tsx | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 specifyweb/frontend/js_src/lib/components/WbPlanView/__tests__/Components.test.tsx diff --git a/specifyweb/frontend/js_src/lib/components/WbPlanView/__tests__/Components.test.tsx b/specifyweb/frontend/js_src/lib/components/WbPlanView/__tests__/Components.test.tsx new file mode 100644 index 00000000000..1d2621087f6 --- /dev/null +++ b/specifyweb/frontend/js_src/lib/components/WbPlanView/__tests__/Components.test.tsx @@ -0,0 +1,47 @@ +import React from 'react'; + +import { clearIdStore } from '../../../hooks/useId'; +import { requireContext } from '../../../tests/helpers'; +import { mount } from '../../../tests/reactUtils'; +import { tables } from '../../DataModel/tables'; +import { ListOfBaseTables } from '../Components'; + +requireContext(); + +beforeEach(() => { + clearIdStore(); +}); + +// [WbPlanView] Prevent selecting base tables without attachments +test('hides base tables without attachments', async () => { + const handleClick = jest.fn(); + + const unrestricted = mount(); + + expect( + unrestricted.getByRole('button', { + name: tables.Geography.label, + }) + ).toBeInTheDocument(); + + unrestricted.unmount(); + + const restricted = mount( + + ); + + expect( + restricted.queryByRole('button', { + name: tables.Geography.label, + }) + ).not.toBeInTheDocument(); + + const accession = restricted.getByRole('button', { + name: tables.Accession.label, + }); + + await restricted.user.click(accession); + + expect(handleClick).toHaveBeenCalledTimes(1); + expect(handleClick).toHaveBeenCalledWith('Accession'); +}); From 982815969a6405862bde0f39b4f423d133cb1e1c Mon Sep 17 00:00:00 2001 From: "Caroline D." <108160931+CarolineDenis@users.noreply.github.com> Date: Tue, 28 Jul 2026 08:10:52 +0000 Subject: [PATCH 2/2] Lint code with ESLint and Prettier Triggered by d17263dd5325a12498b3bf0df8d1ef653ea06d53 on branch refs/heads/issue-8350 --- .../frontend/js_src/lib/localization/utils/validateWeblate.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/localization/utils/validateWeblate.ts b/specifyweb/frontend/js_src/lib/localization/utils/validateWeblate.ts index d37b73ddf9b..40c6123a697 100644 --- a/specifyweb/frontend/js_src/lib/localization/utils/validateWeblate.ts +++ b/specifyweb/frontend/js_src/lib/localization/utils/validateWeblate.ts @@ -96,7 +96,6 @@ const doFetch = async (url: string): Promise> => headers: { Authorization: getToken() }, }).then(async (response) => response.json()); - const fetchComponents = async ( url = componentsApiUrl ): Promise>> =>