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:
@@ -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.');
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user