import {expect, it} from 'vitest';
import {renderToStaticMarkup} from 'react-dom/server';
import type {SitePayload} from '@o2o/shared';
import {MOONLIGHT_STAY_PAYLOAD} from '@site/fixtures/moonlight-stay';
import {App} from './App';
function withTemplate(templateId: string): SitePayload {
const payload = structuredClone(MOONLIGHT_STAY_PAYLOAD);
payload.theme.templateId = templateId;
return payload;
}
it('템플릿이 가리키는 레이아웃의 Frame으로 그린다', () => {
const basic = renderToStaticMarkup();
const paper = renderToStaticMarkup();
expect(basic).toContain('shell flex h-16');
expect(paper).toContain('shell flex h-14');
});
it('여러 템플릿이 같은 레이아웃을 쓴다', () => {
const simple = renderToStaticMarkup();
const retro = renderToStaticMarkup();
expect(retro).toContain('shell flex h-16');
expect(simple).toContain('shell flex h-16');
});
it('등록되지 않은 templateId면 렌더를 멈춘다', () => {
expect(() => renderToStaticMarkup()).toThrow('등록되지 않은 템플릿');
expect(() => renderToStaticMarkup()).toThrow('등록되지 않은 템플릿');
});