InfluxDB: Tests for #73247 (#73250)

* add test assertions to cover default config UI state in influxDB plugin
pull/71398/head
Galen Kistler 2 years ago committed by GitHub
parent 77dc6d532e
commit 1e07c7c874
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      public/app/plugins/datasource/influxdb/components/editor/config/ConfigEditor.test.tsx

@ -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',

Loading…
Cancel
Save