chore: Test performance (#5786)
This commit is contained in:
@@ -152,22 +152,15 @@ describe("#hooks.slack", () => {
|
||||
},
|
||||
});
|
||||
|
||||
return new Promise((resolve) => {
|
||||
// setTimeout is needed here because SearchQuery is saved asynchronously
|
||||
// in order to not slow down the response time.
|
||||
setTimeout(async () => {
|
||||
const searchQuery = await SearchQuery.findAll({
|
||||
where: {
|
||||
teamId: team.id,
|
||||
query: "contains",
|
||||
},
|
||||
});
|
||||
expect(searchQuery.length).toBe(1);
|
||||
expect(searchQuery[0].results).toBe(0);
|
||||
expect(searchQuery[0].source).toBe("slack");
|
||||
resolve(undefined);
|
||||
}, 250);
|
||||
const searchQuery = await SearchQuery.findAll({
|
||||
where: {
|
||||
teamId: team.id,
|
||||
query: "contains",
|
||||
},
|
||||
});
|
||||
expect(searchQuery.length).toBe(1);
|
||||
expect(searchQuery[0].results).toBe(0);
|
||||
expect(searchQuery[0].source).toBe("slack");
|
||||
});
|
||||
|
||||
it("should respond with help content for help keyword", async () => {
|
||||
|
||||
@@ -335,14 +335,12 @@ router.post(
|
||||
? await SearchHelper.searchForUser(user, text, options)
|
||||
: await SearchHelper.searchForTeam(team, text, options);
|
||||
|
||||
void SearchQuery.create({
|
||||
await SearchQuery.create({
|
||||
userId: user ? user.id : null,
|
||||
teamId: team.id,
|
||||
source: "slack",
|
||||
query: text,
|
||||
results: totalCount,
|
||||
}).catch((err) => {
|
||||
Logger.error("Failed to create search query", err);
|
||||
});
|
||||
|
||||
const haventSignedIn = t(
|
||||
|
||||
Reference in New Issue
Block a user