mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-22 08:47:10 +08: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:
@@ -27,7 +27,7 @@ export async function initEmbedSyncedDocState(
|
||||
}
|
||||
|
||||
return await page.evaluate(
|
||||
({ data, option }) => {
|
||||
async ({ data, option }) => {
|
||||
const createDoc = async (
|
||||
docId: string,
|
||||
title: string,
|
||||
@@ -69,11 +69,13 @@ export async function initEmbedSyncedDocState(
|
||||
return note ?? null;
|
||||
};
|
||||
|
||||
const docIds = data.map(({ title, content }, index) => {
|
||||
const id = index === 0 ? window.doc.id : `embed-doc-${index}`;
|
||||
createDoc(id, title, content);
|
||||
return id;
|
||||
});
|
||||
const docIds = await Promise.all(
|
||||
data.map(async ({ title, content }, index) => {
|
||||
const id = index === 0 ? window.doc.id : `embed-doc-${index}`;
|
||||
await createDoc(id, title, content);
|
||||
return id;
|
||||
})
|
||||
);
|
||||
|
||||
const { NoteBlockModel, NoteDisplayMode } =
|
||||
window.$blocksuite.affineModel;
|
||||
|
||||
Reference in New Issue
Block a user