Fix tests
Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com> Co-authored-by: Chris Henn <chris.henn@influxdata.com>pull/10616/head
parent
4894e2e82d
commit
535d34ef05
|
@ -2,7 +2,12 @@ jest.mock('src/utils/ajax', () => require('mocks/utils/ajax'))
|
|||
|
||||
export const getSuggestions = jest.fn(() => Promise.resolve([]))
|
||||
export const getAST = jest.fn(() => Promise.resolve({}))
|
||||
export const getDatabases = jest.fn(() =>
|
||||
Promise.resolve(['db1', 'db2', 'db3'])
|
||||
const showDatabasesResponse = {
|
||||
data: {
|
||||
results: [{series: [{columns: ['name'], values: [['mydb1'], ['mydb2']]}]}],
|
||||
},
|
||||
}
|
||||
export const showDatabases = jest.fn(() =>
|
||||
Promise.resolve(showDatabasesResponse)
|
||||
)
|
||||
export const getTimeSeries = jest.fn(() => Promise.resolve({data: ''}))
|
||||
|
|
|
@ -3,7 +3,7 @@ import {shallow} from 'enzyme'
|
|||
import From from 'src/ifql/components/From'
|
||||
import {service} from 'test/resources'
|
||||
|
||||
jest.mock('src/ifql/apis', () => require('mocks/ifql/apis'))
|
||||
jest.mock('src/shared/apis/metaQuery', () => require('mocks/ifql/apis'))
|
||||
|
||||
const setup = () => {
|
||||
const props = {
|
||||
|
|
|
@ -2,7 +2,6 @@ import {parseResults} from 'src/shared/parsing/v2/results'
|
|||
import {
|
||||
RESPONSE_NO_METADATA,
|
||||
RESPONSE_METADATA,
|
||||
RESPONSE_NO_MEASUREMENT,
|
||||
LARGE_RESPONSE,
|
||||
EXPECTED_METADATA,
|
||||
EXPECTED_COLUMNS,
|
||||
|
@ -34,20 +33,4 @@ describe('IFQL results parser', () => {
|
|||
expect(actual).toEqual(EXPECTED_METADATA)
|
||||
})
|
||||
})
|
||||
|
||||
describe('name', () => {
|
||||
it('uses the measurement as a name when present', () => {
|
||||
const actual = parseResults(RESPONSE_METADATA)[0].name
|
||||
const expected = 'cpu'
|
||||
|
||||
expect(actual).toBe(expected)
|
||||
})
|
||||
|
||||
it('uses the index as a name if a measurement column is not present', () => {
|
||||
const actual = parseResults(RESPONSE_NO_MEASUREMENT)[0].name
|
||||
const expected = 'Result 0'
|
||||
|
||||
expect(actual).toBe(expected)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue