refactor(editor): remove assertExists (#10615)

This commit is contained in:
Saul-Mirone
2025-03-05 00:13:08 +00:00
parent a6692f70aa
commit b8ecfbdae6
106 changed files with 863 additions and 517 deletions

View File

@@ -13,7 +13,6 @@ import {
ParagraphBlockSchemaExtension,
RootBlockSchemaExtension,
} from './test-schema.js';
import { assertExists } from './test-utils-dom.js';
function createTestOptions() {
const idGenerator = createAutoIncrementIdGenerator();
@@ -207,7 +206,9 @@ describe('basic', () => {
const doc2 = collection2.getDoc('space:0', {
extensions,
});
assertExists(doc2);
if (!doc2) {
throw new Error('doc2 is not found');
}
applyUpdate(doc2.spaceDoc, update);
expect(serializCollection(collection2.doc)['spaces']).toEqual({
'space:0': {

View File

@@ -65,13 +65,6 @@ export async function runOnce() {
testCases = [];
}
// XXX: workaround typing issue in blobs/__tests__/test-entry.ts
export function assertExists<T>(val: T | null | undefined): asserts val is T {
if (val === null || val === undefined) {
throw new Error('val does not exist');
}
}
export async function nextFrame() {
return new Promise(resolve => requestAnimationFrame(resolve));
}