mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-26 14:58:55 +08:00
refactor(hooks): reduce null types (#3111)
(cherry picked from commit 8b5d997322)
This commit is contained in:
@@ -3,14 +3,13 @@
|
||||
*/
|
||||
import 'fake-indexeddb/auto';
|
||||
|
||||
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
||||
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import type { Page } from '@blocksuite/store';
|
||||
import { Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { describe, expect, test, vitest } from 'vitest';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
import { beforeEach } from 'vitest';
|
||||
|
||||
import { useBlockSuitePagePreview } from '../use-block-suite-page-preview';
|
||||
@@ -52,17 +51,6 @@ describe('useBlockSuiteWorkspaceName', () => {
|
||||
workspaceNameHook.result.current[1]('test 3');
|
||||
expect(blockSuiteWorkspace.meta.name).toBe('test 3');
|
||||
});
|
||||
|
||||
test('null', () => {
|
||||
const workspaceNameHook = renderHook(() =>
|
||||
useBlockSuiteWorkspaceName(null)
|
||||
);
|
||||
vitest.spyOn(globalThis.console, 'warn');
|
||||
expect(workspaceNameHook.result.current[0]).toBe(UNTITLED_WORKSPACE_NAME);
|
||||
workspaceNameHook.result.current[1]('test');
|
||||
expect(globalThis.console.warn).toHaveBeenCalledTimes(2);
|
||||
expect(workspaceNameHook.result.current[0]).toBe(UNTITLED_WORKSPACE_NAME);
|
||||
});
|
||||
});
|
||||
|
||||
describe('useBlockSuiteWorkspacePageTitle', () => {
|
||||
|
||||
Reference in New Issue
Block a user