Skip to content

Commit

Permalink
feat: tests & storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
hschoenenberger committed Sep 19, 2023
1 parent ce0710b commit 2dcd332
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/components/alert/AlertShopUnlinked.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import AlertShopUnlinked from '@/components/alert/AlertShopUnlinked.vue';
import { VueWrapper, MountingOptions, mount } from '@vue/test-utils';
import { describe, it, expect } from 'vitest';

type ComponentProps = InstanceType<typeof AlertShopUnlinked>['$props'];

describe('AlertShopUnlinked component tests', () => {
let wrapper: VueWrapper<any>;
const findAlert = () => wrapper.find('[data-testid=shop-unlinked-alert]');
const findAlertDescription = () => wrapper.find('[data-testid=shop-unlinked-alert-message]');
const factory = (
props: Partial<ComponentProps> = {},
options: MountingOptions<any> = {}
) => {
wrapper = mount(AlertShopUnlinked, {
props,
...options
});
};

it('should display an alert on warning variant and display the superAdminEmail', () => {
factory({});
expect(findAlert().classes()).toContain('puik-alert--danger');
expect(findAlertDescription().text()).toBeDefined();
});
});
14 changes: 14 additions & 0 deletions src/components/alert/AlertShopUnlinked.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import AlertShopUnlinked from '@/components/alert/AlertShopUnlinked.vue';
import type { Meta, StoryObj } from '@storybook/vue3';

const meta: Meta<typeof AlertShopUnlinked> = {
title: 'Components/Alert/AlertShopUnlinked',
component: AlertShopUnlinked
};

export default meta;
type Story = StoryObj<typeof AlertShopUnlinked>;

export const Default: Story = {
args: {}
};

0 comments on commit 2dcd332

Please sign in to comment.