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:
L-Sun
2025-04-23 08:17:41 +00:00
parent 200015a811
commit a9ad01491c
28 changed files with 136 additions and 121 deletions

View File

@@ -48,7 +48,7 @@ test.describe('split list', () => {
listLocator.nth(2).locator('.affine-list-block__numbered')
).toHaveText('2.');
await expect(listLocator.nth(3).locator('rich-text')).toHaveText('ddd');
expect(
await expect(
listLocator.nth(3).locator('.affine-list-block__numbered')
).toHaveText('3.');

View File

@@ -137,15 +137,14 @@ test.skip('create multi workspace in the workspace list', async ({
await expect(workspaceCards).toHaveCount(3);
}
const workspaceChangePromise = page.evaluate(() => {
new Promise(resolve => {
await page.getByTestId('draggable-item').nth(2).click();
await page.evaluate(async () => {
await new Promise(resolve => {
window.addEventListener('affine:workspace:change', resolve, {
once: true,
});
});
});
await page.getByTestId('draggable-item').nth(2).click();
await workspaceChangePromise;
const nextWorkspace = await workspace.current();