Skip to content

Commit

Permalink
DOP-3707 creates additional test for the version dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Caesar Bell committed Oct 12, 2023
1 parent 7d0ab43 commit 0ac3a54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/context/version-context.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { createContext, useReducer, useEffect, useState, useCallback, useRef, useMemo } from 'react';
import { navigate } from 'gatsby';
import { navigate } from '@gatsbyjs/reach-router';
import { METADATA_COLLECTION } from '../build-constants';
import { useSiteMetadata } from '../hooks/use-site-metadata';
import { useCurrentUrlSlug } from '../hooks/use-current-url-slug';
Expand Down
6 changes: 5 additions & 1 deletion tests/unit/VersionDropdown.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, screen, act, within } from '@testing-library/react';
import { navigate } from 'gatsby';
import { navigate } from '@gatsbyjs/reach-router';
import userEvent from '@testing-library/user-event';
import * as realm from '../../src/utils/realm';
import { generatePrefix } from '../../src/components/VersionDropdown/utils';
Expand All @@ -16,6 +16,10 @@ jest.mock('../../src/utils/use-snooty-metadata', () => {
return () => ({ project: 'node' });
});

jest.mock('@gatsbyjs/reach-router', () => ({
navigate: jest.fn(),
}));

const fetchDocuments = () => {
return jest.spyOn(realm, 'fetchDocuments').mockImplementation(async (dbName, collectionName, query) => {
if (query && query['associated_products'] === 'docs-atlas-cli') {
Expand Down

0 comments on commit 0ac3a54

Please sign in to comment.