Some checks failed
Tests / Build and Push CICD Image (push) Successful in 46m49s
Tests / YAML Syntax Check (push) Successful in 7m40s
Tests / TOML Syntax Check (push) Successful in 53s
Tests / Mixed Line Ending Check (push) Successful in 54s
Tests / TOML Formatting Check (push) Successful in 52s
Tests / Ruff Linting (push) Successful in 55s
Tests / Ruff Format Check (push) Successful in 59s
Tests / Trailing Whitespace Check (push) Successful in 9m41s
Tests / Pyright Type Check (push) Successful in 1m9s
Tests / No Docstring Types Check (push) Successful in 57s
Tests / Darglint Docstring Check (push) Successful in 1m16s
Tests / ESLint Check (push) Successful in 1m6s
Tests / Prettier Format Check (push) Successful in 1m14s
Tests / TypeScript Type Check (push) Successful in 1m12s
Tests / Backend Tests (push) Successful in 1m3s
Tests / TSDoc Lint Check (push) Successful in 1m37s
Tests / Frontend Tests (push) Successful in 1m23s
Tests / Backend Doctests (push) Successful in 1m7s
Tests / End of File Check (push) Successful in 13m53s
Tests / Integration Tests (push) Successful in 6m23s
Tests / End-to-End Tests (push) Has been cancelled
Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
41 lines
1013 B
TypeScript
41 lines
1013 B
TypeScript
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
|
|
// Mock Vue's createApp
|
|
const mockMount = vi.fn();
|
|
const mockApp = {
|
|
mount: mockMount,
|
|
};
|
|
const mockCreateApp = vi.fn(() => mockApp);
|
|
|
|
// Mock the App component
|
|
const mockAppComponent = {};
|
|
|
|
vi.mock('vue', () => ({
|
|
createApp: mockCreateApp,
|
|
}));
|
|
|
|
vi.mock('./App.vue', () => ({
|
|
default: mockAppComponent,
|
|
}));
|
|
|
|
describe('main.ts', () => {
|
|
beforeEach(() => {
|
|
vi.clearAllMocks();
|
|
// Clear the module cache to ensure fresh imports
|
|
vi.resetModules();
|
|
});
|
|
|
|
it('should create Vue app and mount to #app', async () => {
|
|
// Import the module after setting up mocks
|
|
await import('./main');
|
|
|
|
// Verify createApp was called with the App component
|
|
expect(mockCreateApp).toHaveBeenCalledWith(mockAppComponent);
|
|
expect(mockCreateApp).toHaveBeenCalledTimes(1);
|
|
|
|
// Verify mount was called with #app selector
|
|
expect(mockMount).toHaveBeenCalledWith('#app');
|
|
expect(mockMount).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|