mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* add test assertions to cover default config UI state in influxDB plugin
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import { InfluxVersion } from '../../../types';
|
||||||
|
|
||||||
import ConfigEditor, { Props } from './ConfigEditor';
|
import ConfigEditor, { Props } from './ConfigEditor';
|
||||||
|
|
||||||
jest.mock('lodash', () => {
|
jest.mock('lodash', () => {
|
||||||
@@ -62,6 +64,30 @@ describe('ConfigEditor', () => {
|
|||||||
expect(screen.getByDisplayValue('configured')).toBeInTheDocument();
|
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', () => {
|
it('should hide white listed cookies input when browser access chosen', () => {
|
||||||
setup({
|
setup({
|
||||||
access: 'direct',
|
access: 'direct',
|
||||||
|
|||||||
Reference in New Issue
Block a user