25 lines
837 B
TypeScript
25 lines
837 B
TypeScript
import { beforeEach, describe, expect, it } from 'vitest';
|
|
import { screen } from '@testing-library/react';
|
|
import { renderApp, mockAuthenticated, mockGuest } from '@/test/utils';
|
|
import { _resetSetupStatusCache } from '@/router';
|
|
|
|
beforeEach(() => {
|
|
_resetSetupStatusCache();
|
|
});
|
|
|
|
describe('CmsPage', () => {
|
|
it('renders the CMS page title and placeholder', async () => {
|
|
mockAuthenticated();
|
|
renderApp('/cms');
|
|
|
|
expect(await screen.findByTestId('cms-title', {}, { timeout: 5000 })).toBeInTheDocument();
|
|
expect(screen.getByTestId('cms-placeholder')).toBeInTheDocument();
|
|
});
|
|
|
|
it('redirects unauthenticated users to login', async () => {
|
|
mockGuest();
|
|
renderApp('/cms');
|
|
expect(await screen.findByTestId('login-form-submit-button')).toBeInTheDocument();
|
|
});
|
|
});
|