Skip to content

Commit

Permalink
feat: update and fix query-preview tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lauramargar committed Dec 6, 2023
1 parent 1b668c6 commit 42f9c44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function renderQueryPreview({
queryPreviewInfo = { query: 'milk' },
location,
queryFeature,
saveCache = false,
debounceTimeMs = 0,
template = `<QueryPreview v-bind="$attrs" />`,
queryPreview = {
Expand Down Expand Up @@ -66,7 +67,8 @@ function renderQueryPreview({
maxItemsToRender,
queryPreviewInfo,
queryFeature,
debounceTimeMs
debounceTimeMs,
saveCache
}
}
).findComponent(QueryPreview);
Expand Down Expand Up @@ -103,6 +105,7 @@ describe('query preview', () => {

it('sends the `QueryPreviewRequestUpdated` event', async () => {
const { queryPreviewRequestUpdatedSpy, wrapper, updateExtraParams } = renderQueryPreview({
saveCache: false,
queryPreviewInfo: {
query: 'shoes',
extraParams: { directory: 'Magrathea' },
Expand Down Expand Up @@ -425,6 +428,8 @@ interface RenderQueryPreviewOptions {
maxItemsToRender?: number;
/** The query preview info for which preview its results. */
queryPreviewInfo?: QueryPreviewInfo;
/** Boolean to save queries preview in the cache. */
saveCache?: boolean;
/** The location of the query preview in the DOM. */
location?: string;
/** The name of the tool that generated the query. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
);
// If the query has been saved it will emit load instead of the emitting the updated request.
if (this.isSavedQuery) {
if (this.isSavedQuery && this.saveCache) {
this.$emit('load', this.queryPreviewInfo.query);
} else {
this.emitQueryPreviewRequestUpdated(this.queryPreviewRequest);
Expand Down

0 comments on commit 42f9c44

Please sign in to comment.