diff --git a/src/__test__/components/plots/ContinuousEmbeddingPlot.test.jsx b/src/__test__/components/plots/ContinuousEmbeddingPlot.test.jsx index e166b5dfed..760670cb99 100644 --- a/src/__test__/components/plots/ContinuousEmbeddingPlot.test.jsx +++ b/src/__test__/components/plots/ContinuousEmbeddingPlot.test.jsx @@ -4,6 +4,7 @@ import { screen, render } from '@testing-library/react'; import { Provider } from 'react-redux'; import { makeStore } from 'redux/store'; import fetchMock, { enableFetchMocks } from 'jest-fetch-mock'; +import * as PlotSpecGenerators from 'utils/plotSpecs/generateEmbeddingContinuousSpec'; import { dispatchWorkRequest } from 'utils/work/seekWorkResponse'; import { loadBackendStatus } from 'redux/actions/backendStatus'; @@ -101,6 +102,29 @@ describe('Continuous embedding plot', () => { expect(screen.getByRole('graphics-document', { name: 'Continuous embedding plot' })).toBeInTheDocument(); }); + it('Calls generateData with truncatedPlotData when config.truncatedValues is true', async () => { + // Spy on the function + const generateDataSpy = jest.spyOn(PlotSpecGenerators, 'generateData'); + + await renderContinuousEmbeddingPlot(storeState, { + config: { + ...initialPlotConfigStates.embeddingContinuous, + truncatedValues: true, + }, + }); + + // Check if generateData was called with truncatedPlotData + expect(generateDataSpy).toHaveBeenCalledWith( + expect.anything(), // cellSets + expect.anything(), // selectedSample + truncatedPlotData, // truncatedPlotData + expect.anything(), // embeddingData + ); + + // Cleanup + generateDataSpy.mockRestore(); + }); + it('Shows a loader if there is no config', async () => { await act(async () => { render( diff --git a/src/components/Loader.jsx b/src/components/Loader.jsx index 95846db4da..8ca1d642f7 100644 --- a/src/components/Loader.jsx +++ b/src/components/Loader.jsx @@ -60,7 +60,6 @@ const Loader = ({ experimentId }) => { () => (experimentId ? `/v2/experiments/${experimentId}/backendStatus` : null), fetchAPI, ); - console.log('workerStatus', workerStatus); if (!workerStatus) { return ( diff --git a/src/components/plots/ContinuousEmbeddingPlot.jsx b/src/components/plots/ContinuousEmbeddingPlot.jsx index bdc2992efc..634ba1dc76 100644 --- a/src/components/plots/ContinuousEmbeddingPlot.jsx +++ b/src/components/plots/ContinuousEmbeddingPlot.jsx @@ -16,7 +16,7 @@ import changeEmbeddingAxesIfNecessary from './helpers/changeEmbeddingAxesIfNeces const ContinuousEmbeddingPlot = (props) => { const { experimentId, config, - plotData, + plotData, truncatedPlotData, actions, loading, error, reloadPlotData, onUpdate, } = props; @@ -67,7 +67,7 @@ const ContinuousEmbeddingPlot = (props) => { generateData( cellSets, config.selectedSample, - plotData, + config.truncatedValues ? truncatedPlotData : plotData, embeddingData, ), ), @@ -130,7 +130,10 @@ const ContinuousEmbeddingPlot = (props) => { }; ContinuousEmbeddingPlot.defaultProps = { + reloadPlotData: () => { }, + config: null, plotData: null, + truncatedPlotData: null, actions: true, }; @@ -138,6 +141,7 @@ ContinuousEmbeddingPlot.propTypes = { experimentId: PropTypes.string.isRequired, config: PropTypes.object, plotData: PropTypes.array, + truncatedPlotData: PropTypes.array, actions: PropTypes.oneOfType([ PropTypes.bool, PropTypes.object, @@ -148,10 +152,4 @@ ContinuousEmbeddingPlot.propTypes = { onUpdate: PropTypes.func.isRequired, }; -ContinuousEmbeddingPlot.defaultProps = { - reloadPlotData: () => { }, - config: null, - truncatedPlotData: null, -}; - export default ContinuousEmbeddingPlot;