fix: sort plugin list in test (#4289)

This commit is contained in:
Whitewater 2023-09-09 06:36:48 +08:00 committed by GitHub
parent 5f0605a5d9
commit 56e653140b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,9 @@ test('plugin should exist', async ({ page }) => {
await page.waitForTimeout(50);
const packageJson = await page.evaluate(() => {
// @ts-expect-error
return window.__pluginPackageJson__;
return window.__pluginPackageJson__.sort((a, b) =>
a.name.localeCompare(b.name)
);
});
const plugins = [
'@affine/bookmark-plugin',
@ -28,11 +30,13 @@ test('plugin should exist', async ({ page }) => {
'@affine/outline-plugin',
];
expect(packageJson).toEqual(
plugins.map(name => ({
plugins
.map(name => ({
name,
version: expect.any(String),
description: expect.any(String),
affinePlugin: expect.anything(),
}))
.sort((a, b) => a.name.localeCompare(b.name))
);
});