Skip to content

Commit

Permalink
Migrated to vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyanotfound committed Nov 27, 2024
1 parent e563843 commit 70f60e4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
25 changes: 25 additions & 0 deletions src/components/AddOn/support/components/Action/Action.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import { render } from '@testing-library/react';
import { Provider } from 'react-redux';
import { describe, test, expect } from 'vitest'; // Import from Vitest

import { store } from 'state/store';
import Action from './Action';

describe('Testing Action Component', () => {
const props = {
children: 'dummy children',
label: 'dummy label',
};

test('should render props and text elements for the page component', () => {
const { getByText } = render(
<Provider store={store}>
<Action {...props} />
</Provider>,
);

expect(getByText(props.label)).toBeInTheDocument();
expect(getByText(props.children)).toBeInTheDocument();
});
});
3 changes: 2 additions & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'vite';
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import tsconfigPaths from 'vite-tsconfig-paths';
Expand All @@ -15,6 +15,7 @@ export default defineConfig({
include: ['src/**/*.spec.{js,jsx,ts,tsx}'],
globals: true,
environment: 'jsdom',
setupFiles: 'vitest.setup.ts',
coverage: {
enabled: true,
provider: 'istanbul',
Expand Down
1 change: 1 addition & 0 deletions vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom';

0 comments on commit 70f60e4

Please sign in to comment.