You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/react/edge/edge-stacks/utils.test.ts

41 lines
1.1 KiB

import { EnvironmentType } from '@/react/portainer/environments/types';
import { EditorType } from './types';
import { getValidEditorTypes } from './utils';
interface GetValidEditorTypesTest {
endpointTypes: EnvironmentType[];
expected: EditorType[];
title: string;
}
describe('getValidEditorTypes', () => {
const tests: GetValidEditorTypesTest[] = [
{
endpointTypes: [EnvironmentType.EdgeAgentOnDocker],
expected: [EditorType.Compose],
title: 'should return compose for docker envs',
},
{
endpointTypes: [EnvironmentType.EdgeAgentOnKubernetes],
expected: [EditorType.Kubernetes],
title: 'should return kubernetes for kubernetes envs',
},
{
endpointTypes: [
EnvironmentType.EdgeAgentOnDocker,
EnvironmentType.EdgeAgentOnKubernetes,
],
expected: [],
title: 'should return empty for docker and kubernetes envs',
},
];
tests.forEach((test) => {
// eslint-disable-next-line vitest/valid-title
it(test.title, () => {
expect(getValidEditorTypes(test.endpointTypes)).toEqual(test.expected);
});
});
});