mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 08:19:40 +02:00
refactor(tests): wrap tests explicitly with provider [EE-6686] (#11090)
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
This commit is contained in:
parent
27aaf322b2
commit
f8e3d75797
53 changed files with 432 additions and 263 deletions
|
@ -1,4 +1,5 @@
|
|||
import { render, screen } from '@/react-tools/test-utils';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
|
||||
import {
|
||||
EnvVarType,
|
||||
TemplateViewModel,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { vi } from 'vitest';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
import { render, screen } from '@/react-tools/test-utils';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
|
||||
import {
|
||||
EnvVarsFieldset,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { vi } from 'vitest';
|
||||
|
||||
import { render, screen } from '@/react-tools/test-utils';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
|
||||
import { TemplateNote } from './TemplateNote';
|
||||
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
import { vi } from 'vitest';
|
||||
import { HttpResponse, http } from 'msw';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
|
||||
import { renderWithQueryClient, screen } from '@/react-tools/test-utils';
|
||||
import { AppTemplate } from '@/react/portainer/templates/app-templates/types';
|
||||
import { CustomTemplate } from '@/react/portainer/templates/custom-templates/types';
|
||||
import { server } from '@/setup-tests/server';
|
||||
import selectEvent from '@/react/test-utils/react-select';
|
||||
import { withTestQueryProvider } from '@/react/test-utils/withTestQuery';
|
||||
|
||||
import { SelectedTemplateValue } from './types';
|
||||
import { TemplateSelector } from './TemplateSelector';
|
||||
|
||||
test('renders TemplateSelector component', async () => {
|
||||
render();
|
||||
renderComponent();
|
||||
|
||||
const templateSelectorElement = screen.getByLabelText('Template');
|
||||
expect(templateSelectorElement).toBeInTheDocument();
|
||||
|
@ -30,7 +31,7 @@ test.skip('selects an edge app template', async () => {
|
|||
categories: ['edge'],
|
||||
};
|
||||
|
||||
const { select } = render({
|
||||
const { select } = renderComponent({
|
||||
onChange,
|
||||
appTemplates: [
|
||||
{
|
||||
|
@ -59,7 +60,7 @@ test.skip('selects an edge custom template', async () => {
|
|||
Id: 2,
|
||||
};
|
||||
|
||||
const { select } = render({
|
||||
const { select } = renderComponent({
|
||||
onChange,
|
||||
customTemplates: [
|
||||
{
|
||||
|
@ -75,7 +76,7 @@ test.skip('selects an edge custom template', async () => {
|
|||
});
|
||||
|
||||
test('renders with error', async () => {
|
||||
render({
|
||||
renderComponent({
|
||||
error: 'Invalid template',
|
||||
});
|
||||
|
||||
|
@ -87,7 +88,7 @@ test('renders with error', async () => {
|
|||
});
|
||||
|
||||
test.skip('renders TemplateSelector component with no custom templates available', async () => {
|
||||
render({
|
||||
renderComponent({
|
||||
customTemplates: [],
|
||||
});
|
||||
|
||||
|
@ -102,7 +103,7 @@ test.skip('renders TemplateSelector component with no custom templates available
|
|||
expect(noCustomTemplatesElement).toBeInTheDocument();
|
||||
});
|
||||
|
||||
function render({
|
||||
function renderComponent({
|
||||
onChange = vi.fn(),
|
||||
appTemplates = [],
|
||||
customTemplates = [],
|
||||
|
@ -123,8 +124,10 @@ function render({
|
|||
)
|
||||
);
|
||||
|
||||
renderWithQueryClient(
|
||||
<TemplateSelector
|
||||
const Wrapped = withTestQueryProvider(TemplateSelector);
|
||||
|
||||
render(
|
||||
<Wrapped
|
||||
value={{ template: undefined, type: undefined }}
|
||||
onChange={onChange}
|
||||
error={error}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue