mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
refactor(editor): remove assertExists (#10615)
This commit is contained in:
@@ -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': {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user