-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proto elastic suggester #1549
proto elastic suggester #1549
Conversation
efaf31d
to
dd94d54
Compare
packages/code-du-travail-api/src/server/routes/__tests__/suggest.spec.js
Outdated
Show resolved
Hide resolved
packages/code-du-travail-api/src/server/routes/__tests__/suggest.spec.js
Outdated
Show resolved
Hide resolved
packages/code-du-travail-api/src/server/routes/suggest/index.js
Outdated
Show resolved
Hide resolved
whoops, my bad c'est toujours WIP, je crois pas que je puisse revert de open à draft |
bd1da7e
to
1984f54
Compare
} | ||
|
||
test("return suggestions for re in the right format", () => | ||
getSuggestions("re") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use async in test case ? It would be easier to read.
test("return suggestions for re in the right format", async () => {
const response = await request(app.callback()).get(`/api/v1/suggest?q=re`);
expect(response.status).toBe(200)
expect(response.get("Content-type").toMatch(/json/);
expect(response.body).toMatchSnapshot()
})
if can also create a getSuggestion helder
async function getSuggestion(query) {
return request(app.callback()).get(`/api/v1/suggest?q=${query}`);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getSuggestions
still return a promise, but the test cases are now using async for readability. Hope you're fine with this.
@rmelisson Looks good. just few comments :) nice job! |
wip