Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-huridocs committed Feb 4, 2025
1 parent 622d0a6 commit b73e1b0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
17 changes: 14 additions & 3 deletions app/react/App/specs/Routes.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ import { LibraryTable } from 'app/Library/LibraryTable';
import { PageView } from 'app/Pages/PageView';
import { ViewerRoute } from 'app/Viewer/ViewerRoute';
import { LibraryMap } from 'app/Library/LibraryMap';
import LibraryRoot from 'app/Library/Library';

let settings: ClientSettings;
let userId: string;

jest.mock('app/appRoutes');

describe('Routes', () => {
beforeEach(() => {
settings = { home_page: '', defaultLibraryView: 'table', private: false };
Expand Down Expand Up @@ -54,8 +57,12 @@ describe('Routes', () => {
"/library/map/?searchTerm:'mySearch',types:!('63f64f8bd793c9aae9925032')";
const { element, parameters } = getIndexElement(settings, undefined);
expect(parameters).toBeUndefined();
expect(element).toMatchObject(<LibraryMap />);
expect(element.props.params).toMatchObject({
expect(element).toMatchObject(
<LibraryRoot>
<LibraryMap />
</LibraryRoot>
);
expect(element.props.children.props.params).toMatchObject({
q: "(searchTerm:'mySearch',types:!('63f64f8bd793c9aae9925032'))",
});
});
Expand All @@ -76,7 +83,11 @@ describe('Routes', () => {
describe('no logged in user', () => {
it('should render the default library view', () => {
const { element, parameters } = getIndexElement(settings, undefined);
expect(element).toMatchObject(<LibraryTable />);
expect(element).toMatchObject(
<LibraryRoot>
<LibraryTable />
</LibraryRoot>
);
expect(parameters).toBeUndefined();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ exports[`Settings Thesauri ThesauriList render existing thesauri should show a l
>
<a
class="block lg:hidden "
data-discover="true"
href="/settings"
>
<svg
Expand Down Expand Up @@ -664,6 +665,23 @@ exports[`Settings Thesauri ThesauriList render existing thesauri should show a l
</tbody>
</table>
</div>
<div
id="DndDescribedBy-0"
style="display: none;"
>
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
</div>
<div
aria-atomic="true"
aria-live="assertive"
id="DndLiveRegion-0"
role="status"
style="position: fixed; top: 0px; left: 0px; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;"
/>
</div>
</div>
<div
Expand Down

0 comments on commit b73e1b0

Please sign in to comment.