refactor(editor): Rename design-system unit test files and snapshots (no-changelog) (#11539)

This commit is contained in:
Alex Grozav
2024-11-05 14:20:02 +02:00
committed by GitHub
parent 63d454b776
commit 5ca781bf3a
152 changed files with 45 additions and 44 deletions

View File

@@ -0,0 +1,35 @@
import { createComponentRenderer } from '@/__tests__/render';
import V1Banner from './V1Banner.vue';
import { createPinia, setActivePinia } from 'pinia';
import { useUsersStore } from '@/stores/users.store';
import { ROLE } from '@/constants';
import type { IUser } from '@/Interface';
const renderComponent = createComponentRenderer(V1Banner);
describe('V1 Banner', () => {
let pinia: ReturnType<typeof createPinia>;
let usersStore: ReturnType<typeof useUsersStore>;
beforeEach(async () => {
pinia = createPinia();
setActivePinia(pinia);
usersStore = useUsersStore();
});
it('should render banner', () => {
const { container } = renderComponent();
expect(container).toMatchSnapshot();
expect(container.querySelectorAll('a')).toHaveLength(1);
});
it('should render banner with dismiss call if user is owner', () => {
usersStore.usersById = { '1': { role: ROLE.Owner } as IUser };
usersStore.currentUserId = '1';
const { container } = renderComponent();
expect(container).toMatchSnapshot();
expect(container.querySelectorAll('a')).toHaveLength(2);
});
});