mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
test(core): enable no-floating-promises rule for tests (#11915)
Sometimes, missing `await` in the test code can cause timing issues, leading to test failures. This PR enables the `no-floating-promises` rule for the test code to ensure that such errors do not occur.
This commit is contained in:
@@ -22,12 +22,18 @@ describe('async-queue', () => {
|
||||
let v = -1;
|
||||
|
||||
// setup 2 pop tasks
|
||||
queue.next().then(next => {
|
||||
v = next;
|
||||
});
|
||||
queue.next().then(next => {
|
||||
v = next;
|
||||
});
|
||||
queue
|
||||
.next()
|
||||
.then(next => {
|
||||
v = next;
|
||||
})
|
||||
.catch(console.error);
|
||||
queue
|
||||
.next()
|
||||
.then(next => {
|
||||
v = next;
|
||||
})
|
||||
.catch(console.error);
|
||||
|
||||
// Wait for 100ms
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
|
||||
Reference in New Issue
Block a user