Skip to content

Commit

Permalink
fix stories
Browse files Browse the repository at this point in the history
  • Loading branch information
mkilpatrick committed Aug 10, 2023
1 parent 500e72d commit 9d28c3f
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/components/MapboxMap.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useRef, useEffect } from 'react';
import mapboxgl, { MapboxOptions, MarkerOptions} from 'mapbox-gl';
import mapboxgl, { MapboxOptions, MarkerOptions } from 'mapbox-gl';
import { Result, useSearchState } from '@yext/search-headless-react';
import { useDebouncedFunction } from '../hooks/useDebouncedFunction';
import ReactDOM from 'react-dom';

const {Marker, LngLatBounds } = mapboxgl;
const { Marker, LngLatBounds } = mapboxgl;

/**
* A functional component that can be used to render a custom marker on the map.
Expand Down
4 changes: 2 additions & 2 deletions tests/components/FieldValueDirectAnswer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const fieldValueDAResult = fieldValueDAState.result as FieldValueDirectAnswerTyp

describe('FieldValue direct answer', () => {

it('executes viewDetailsClickHandler when click on "View Details" link', () => {
it('executes viewDetailsClickHandler when click on "View Details" link', async () => {
const viewDetailsClickHandler = jest.fn();
render(<FieldValueDirectAnswer
result={fieldValueDAResult}
viewDetailsClickHandler={viewDetailsClickHandler}/>
);
userEvent.click(screen.getByRole('link', { name: 'View Details' }));
await userEvent.click(screen.getByRole('link', { name: 'View Details' }));
expect(viewDetailsClickHandler).toHaveBeenCalledTimes(1);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/components/HierarchicalFacet.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { DisplayableFacets } from '../__fixtures__/data/filters';
import { createHierarchicalFacet } from '../__utils__/hierarchicalfacets';

const meta: ComponentMeta<typeof Facets> = {
title: 'Facets',
title: 'HierarchicalFacet',
component: Facets
};
export default meta;
Expand Down
4 changes: 2 additions & 2 deletions tests/components/LocationBias.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Loading.parameters = {
isFetching: true
}
};
Loading.play = ({ canvasElement }) => {
Loading.play = async ({ canvasElement }) => {
const canvas = within(canvasElement);
userEvent.click(canvas.getByText('Update your location'));
await userEvent.click(canvas.getByText('Update your location'));
};
2 changes: 1 addition & 1 deletion tests/components/NumericalFacet.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { DisplayableFacets } from '../__fixtures__/data/filters';
import { createHierarchicalFacet } from '../__utils__/hierarchicalfacets';

const meta: ComponentMeta<typeof Facets> = {
title: 'Facets',
title: 'NumbericalFacets',
component: Facets
};
export default meta;
Expand Down
4 changes: 2 additions & 2 deletions tests/components/SearchBar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ComponentMeta, Story } from '@storybook/react';
import { SearchHeadlessContext } from '@yext/search-headless-react';
import { AutocompleteResponse, SearchHeadlessContext } from '@yext/search-headless-react';

import { generateMockedHeadless } from '../__fixtures__/search-headless';
import { SearchBar, SearchBarProps } from '../../src/components';
Expand All @@ -15,7 +15,7 @@ const mockedAutocompleteResult = {
}],
inputIntents: [],
uuid: ''
};
} as unknown as AutocompleteResponse;

const meta: ComponentMeta<typeof SearchBar> = {
title: 'SearchBar',
Expand Down
12 changes: 6 additions & 6 deletions tests/components/SearchBar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ describe('SearchBar', () => {
results: [{ value: 'query suggestion 1' }],
inputIntents: [],
uuid: ''
} as unknown as AutocompleteResponse;;
} as unknown as AutocompleteResponse;
const mockedUniversalAutocompleteResultTwo = {
results: [{ value: 'query suggestion 2' }],
inputIntents: [],
uuid: ''
} as unknown as AutocompleteResponse;;
} as unknown as AutocompleteResponse;
const mockedUniversalAutocomplete = jest
.spyOn(SearchCore.prototype, 'universalAutocomplete')
.mockResolvedValueOnce(mockedUniversalAutocompleteResultOne)
Expand Down Expand Up @@ -141,7 +141,7 @@ describe('SearchBar', () => {
}],
inputIntents: [],
uuid: ''
} as unknown as AutocompleteResponse;;
} as unknown as AutocompleteResponse;

beforeEach(() => {
jest.spyOn(SearchCore.prototype, 'universalAutocomplete')
Expand Down Expand Up @@ -335,7 +335,7 @@ describe('SearchBar', () => {
results: [{ value: 'query suggestion 1' }],
inputIntents: [SearchIntent.NearMe],
uuid: ''
} as unknown as AutocompleteResponse;;
} as unknown as AutocompleteResponse;
const mockedUniversalSearch = jest.spyOn(SearchCore.prototype, 'universalSearch');
jest.spyOn(SearchCore.prototype, 'universalAutocomplete')
.mockResolvedValue(mockedUniversalAutocompleteResult);
Expand Down Expand Up @@ -368,7 +368,7 @@ describe('SearchBar', () => {
results: [{ value: 'query suggestion' }],
inputIntents: [],
uuid: ''
} as unknown as AutocompleteResponse;;
} as unknown as AutocompleteResponse;
const mockedReport = jest.fn();

beforeEach(() => {
Expand Down Expand Up @@ -442,7 +442,7 @@ describe('SearchBar', () => {
],
inputIntents: [],
uuid: ''
} as unknown as AutocompleteResponse;;
} as unknown as AutocompleteResponse;
jest.spyOn(SearchCore.prototype, 'universalAutocomplete')
.mockResolvedValue(mockedAutocompleteResult);
render(
Expand Down
2 changes: 1 addition & 1 deletion tests/components/StandardFacet.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { RecursivePartial } from '../__utils__/mocks';
import { DisplayableFacets } from '../__fixtures__/data/filters';

const meta: ComponentMeta<typeof Facets> = {
title: 'Facets',
title: 'StandardFacet',
component: Facets
};
export default meta;
Expand Down

0 comments on commit 9d28c3f

Please sign in to comment.