mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
test(editor): remove jsx snapshot (#9463)
This commit is contained in:
@@ -21,6 +21,8 @@ const fieldChecker: Record<string, (value: any) => boolean> = {
|
||||
},
|
||||
};
|
||||
|
||||
const skipFields = new Set(['_lastXYWH']);
|
||||
|
||||
const snapshotTest = async (snapshotUrl: string, elementsCount: number) => {
|
||||
const pageService = window.editor.host!.std.getService('affine:page');
|
||||
if (!pageService) {
|
||||
@@ -66,17 +68,22 @@ const snapshotTest = async (snapshotUrl: string, elementsCount: number) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (skipFields.has(field)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fieldChecker[typeField] || fieldChecker[field]) {
|
||||
const checker = fieldChecker[typeField] || fieldChecker[field];
|
||||
expect(checker(value)).toBe(true);
|
||||
} else {
|
||||
expect(
|
||||
value,
|
||||
`type: ${element.type} field: "${field}"`
|
||||
).not.toBeUndefined();
|
||||
expect(value, `type: ${element.type} field: "${field}"`).not.toBeNull();
|
||||
expect(value, `type: ${element.type} field: "${field}"`).not.toBeNaN();
|
||||
return;
|
||||
}
|
||||
|
||||
expect(
|
||||
value,
|
||||
`type: ${element.type} field: "${field}"`
|
||||
).not.toBeUndefined();
|
||||
expect(value, `type: ${element.type} field: "${field}"`).not.toBeNull();
|
||||
expect(value, `type: ${element.type} field: "${field}"`).not.toBeNaN();
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -89,13 +96,11 @@ beforeEach(async () => {
|
||||
|
||||
const xywhPattern = /\[(\s*-?\d+(\.\d+)?\s*,){3}(\s*-?\d+(\.\d+)?\s*)\]/;
|
||||
|
||||
// FIXME: snapshot tests
|
||||
test.skip('snapshot 1 importing', async () => {
|
||||
test('snapshot 1 importing', async () => {
|
||||
await snapshotTest('https://test.affineassets.com/test-snapshot-1.zip', 25);
|
||||
});
|
||||
|
||||
// FIXME: snapshot tests
|
||||
test.skip('snapshot 2 importing', async () => {
|
||||
test('snapshot 2 importing', async () => {
|
||||
await snapshotTest(
|
||||
'https://test.affineassets.com/test-snapshot-2%20(onboarding).zip',
|
||||
174
|
||||
|
||||
Reference in New Issue
Block a user