InfluxDB: Tests for #73247 (#73250)

* add test assertions to cover default config UI state in influxDB plugin
This commit is contained in:
Galen Kistler
2023-08-15 11:50:50 -05:00
committed by GitHub
parent 77dc6d532e
commit 1e07c7c874

View File

@@ -1,6 +1,8 @@
import { render, screen } from '@testing-library/react';
import React from 'react';
import { InfluxVersion } from '../../../types';
import ConfigEditor, { Props } from './ConfigEditor';
jest.mock('lodash', () => {
@@ -62,6 +64,30 @@ describe('ConfigEditor', () => {
expect(screen.getByDisplayValue('configured')).toBeInTheDocument();
});
it('influxQL options should show up if version is not defined', () => {
setup({});
expect(screen.queryByLabelText('Password')).toBeInTheDocument();
});
it('influxQL options should show up if version is ill-defined', () => {
setup({
jsonData: {
version: 'influx',
},
});
expect(screen.queryByLabelText('Password')).toBeInTheDocument();
});
it('influxQL options should not show up if version is defined as flux', () => {
setup({
jsonData: {
version: InfluxVersion.Flux,
},
});
expect(screen.queryByLabelText('Password')).not.toBeInTheDocument();
expect(screen.queryByLabelText('Token')).toBeInTheDocument();
});
it('should hide white listed cookies input when browser access chosen', () => {
setup({
access: 'direct',