mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 19:29:34 +08:00
Correct failing test
WARNING: forEach is a trap when async is involved cause it leaks promises for X of Y is a very clean workaround that keeps the code ver readable
This commit is contained in:
@ -80,10 +80,10 @@ QUnit.test("it skips a search depending on punctuations", async assert => {
|
|||||||
"@sam:"
|
"@sam:"
|
||||||
];
|
];
|
||||||
|
|
||||||
skippedTerms.forEach(async term => {
|
for (let term of skippedTerms) {
|
||||||
let results = await userSearch({ term });
|
let results = await userSearch({ term });
|
||||||
assert.equal(results.length, 0);
|
assert.equal(results.length, 0);
|
||||||
});
|
}
|
||||||
|
|
||||||
let allowedTerms = [
|
let allowedTerms = [
|
||||||
"@sam sam", // double space is not allowed
|
"@sam sam", // double space is not allowed
|
||||||
@ -93,8 +93,8 @@ QUnit.test("it skips a search depending on punctuations", async assert => {
|
|||||||
|
|
||||||
let topicId = 100;
|
let topicId = 100;
|
||||||
|
|
||||||
allowedTerms.forEach(async term => {
|
for (let term of allowedTerms) {
|
||||||
let results = await userSearch({ term, topicId });
|
let results = await userSearch({ term, topicId });
|
||||||
assert.equal(results.length, 6);
|
assert.equal(results.length, 6);
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user