33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
|
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||
|
|
import { mount } from '@vue/test-utils';
|
||
|
|
|
||
|
|
vi.mock('@inertiajs/vue3', async () => import('../stubs/inertia.js'));
|
||
|
|
|
||
|
|
import AppLayout from '../../../resources/js/Layouts/AppLayout.vue';
|
||
|
|
import { resetInertiaMock } from '../stubs/inertia.js';
|
||
|
|
|
||
|
|
describe('AppLayout', () => {
|
||
|
|
beforeEach(() => {
|
||
|
|
resetInertiaMock();
|
||
|
|
});
|
||
|
|
|
||
|
|
it('renders brand, nav links, slot content, and footer', () => {
|
||
|
|
const wrapper = mount(AppLayout, {
|
||
|
|
slots: { default: '<p class="page-content">Page body</p>' },
|
||
|
|
});
|
||
|
|
|
||
|
|
const links = wrapper.findAll('a[data-inertia]');
|
||
|
|
expect(links.map((link) => link.attributes('href'))).toEqual([
|
||
|
|
'/prompts',
|
||
|
|
'/prompts',
|
||
|
|
'/prompts/create',
|
||
|
|
]);
|
||
|
|
expect(links[0].text()).toContain('PromptVault');
|
||
|
|
expect(links[1].text()).toBe('Prompts');
|
||
|
|
expect(links[2].text()).toContain('New Prompt');
|
||
|
|
|
||
|
|
expect(wrapper.find('.page-content').text()).toBe('Page body');
|
||
|
|
expect(wrapper.find('footer').text()).toContain('Local-first prompt library');
|
||
|
|
});
|
||
|
|
});
|