/** N1 (C40): the tab a version opens on. */ import { afterEach, describe, expect, it, vi } from 'vitest' import { initialTab } from '@/editor/tabs' import { emptyText } from '../helpers/editorFixtures' import { baseText, openReady, resetStore, store, } from '../helpers/editorHarness' vi.mock('@/lib/supabase', () => ({ getSupabaseClient: () => ({}) })) vi.mock('@faunosteo/supabase', async (orig) => ({ ...(await orig()), getSheetVersion: vi.fn(), downloadSheetDrawing: vi.fn(), saveSheetDraft: vi.fn(), getOfficialSheetAdmin: vi.fn(), submitSheetReview: vi.fn(), })) afterEach(resetStore) async function stateOf(text: string) { await openReady({ text }) return store.getState().previewState! } describe('initialTab', () => { it('opens an empty new draft on Général', async () => { expect(initialTab(await stateOf(emptyText()), 'wide')).toBe('general') }) it('opens a draft with a measured view on Annotations', async () => { expect(initialTab(await stateOf(baseText()), 'wide')).toBe('annotations') }) it('keeps Annotations on a tier that does not list Général', async () => { expect(initialTab(await stateOf(emptyText()), 'small')).toBe('annotations') }) })