Skip to content

Commit

Permalink
Fix relevance tuning API routes to not need a separate mock router fo…
Browse files Browse the repository at this point in the history
…r validating query & body
  • Loading branch information
cee-chen committed Feb 4, 2021
1 parent 632b5df commit 22f5665
Showing 1 changed file with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,29 +188,18 @@ describe('search settings routes', () => {
});

describe('validates query', () => {
const queryRouter = new MockRouter({
method: 'post',
path: '/api/app_search/engines/{engineName}/search_settings_search',
payload: 'query',
});

it('correctly', () => {
registerSearchSettingsRoutes({
...mockDependencies,
router: queryRouter.router,
});

const request = {
query: {
query: 'foo',
},
};
queryRouter.shouldValidate(request);
mockRouter.shouldValidate(request);
});

it('missing required fields', () => {
const request = { query: {} };
queryRouter.shouldThrow(request);
mockRouter.shouldThrow(request);
});
});
});
Expand Down

0 comments on commit 22f5665

Please sign in to comment.