chore(prettier): apply arrow parens rule to ts test files

pull/5690/head
Pavel Zavora 2021-03-08 12:34:19 +01:00
parent d0560bf364
commit 05dad39a04
9 changed files with 147 additions and 50 deletions

View File

@ -68,7 +68,7 @@ describe('DataExplorer.Reducers.UI', () => {
it('can delete a dashboard', () => {
const actual = reducer({...initialState, dashboards}, deleteDashboard(d1))
const expected = dashboards.filter(dash => dash.id !== d1.id)
const expected = dashboards.filter((dash) => dash.id !== d1.id)
expect(actual.dashboards).toEqual(expected)
})

View File

@ -2,10 +2,10 @@ import ActiveKapacitorFromSources from 'src/kapacitor/utils/ActiveKapacitorFromS
import {source, kapacitor} from 'mocks/dummy'
describe('ActiveKapacitorFromSources', () => {
const createSource = attrs => ({...source, ...attrs})
const createKapacitor = attrs => ({...kapacitor, ...attrs})
const createSource = (attrs) => ({...source, ...attrs})
const createKapacitor = (attrs) => ({...kapacitor, ...attrs})
const setup = overrides => {
const setup = (overrides) => {
const activeSource = createSource({id: 1, ...overrides})
const sources = [

View File

@ -63,7 +63,7 @@ describe('kapacitor.utils.alertMessageValidation', () => {
'CI ID = {{ with (index .Tags "ci_id") }}{{ . }}{{ else }}Unknown{{ end }}',
'CI ID = {{ if (index .Tags "ci_id") }}{{ index .Tags "ci_id" }}{{ else -}} Unknown {{- end }}',
'# of Tags = {{ len .Tags }}',
].forEach(m => {
].forEach((m) => {
it(`#5343 accepts message '${m}'`, () => {
const isValid = isValidMessage(m)
expect(isValid).toEqual(true)

View File

@ -11,13 +11,19 @@ describe('parseHistogramQueryResponse', () => {
name: 'syslog',
tags: {severity: 'debug'},
columns: ['time', 'count'],
values: [[1530129062000, 0], [1530129093000, 0]],
values: [
[1530129062000, 0],
[1530129093000, 0],
],
},
{
name: 'syslog',
tags: {severity: 'err'},
columns: ['time', 'count'],
values: [[1530129062000, 0], [1530129093000, 0]],
values: [
[1530129062000, 0],
[1530129093000, 0],
],
},
],
},

View File

@ -4,11 +4,17 @@ describe('Logs.Utils.Table', () => {
const infiniteTableData = {
forward: {
columns: ['time', 'noise'],
values: [[8, 'beep'], [7, 'boop']],
values: [
[8, 'beep'],
[7, 'boop'],
],
},
backward: {
columns: ['time', 'noise'],
values: [[6, 'bloop'], [5, 'bleep']],
values: [
[6, 'bloop'],
[5, 'bleep'],
],
},
}

View File

@ -34,7 +34,7 @@ describe('Shared.Reducers.sources', () => {
})
)
expect(state.filter(s => s.default).length).toBe(1)
expect(state.filter((s) => s.default).length).toBe(1)
})
it('can correctly show default sources when updating a source', () => {

View File

@ -122,11 +122,11 @@ describe('topologicalSort', () => {
]
const graph = graphFromTemplates(templates)
const a = graph.find(n => n.initialTemplate.id === 'a')
const b = graph.find(n => n.initialTemplate.id === 'b')
const c = graph.find(n => n.initialTemplate.id === 'c')
const d = graph.find(n => n.initialTemplate.id === 'd')
const e = graph.find(n => n.initialTemplate.id === 'e')
const a = graph.find((n) => n.initialTemplate.id === 'a')
const b = graph.find((n) => n.initialTemplate.id === 'b')
const c = graph.find((n) => n.initialTemplate.id === 'c')
const d = graph.find((n) => n.initialTemplate.id === 'd')
const e = graph.find((n) => n.initialTemplate.id === 'e')
const sorted = topologicalSort(graph)
@ -247,15 +247,15 @@ describe('graphFromTemplates', () => {
]
const graph = graphFromTemplates(templates)
const a = graph.find(n => n.initialTemplate === templates[0])
const b = graph.find(n => n.initialTemplate === templates[1])
const c = graph.find(n => n.initialTemplate === templates[2])
const d = graph.find(n => n.initialTemplate === templates[3])
const e = graph.find(n => n.initialTemplate === templates[4])
const f = graph.find(n => n.initialTemplate === templates[5])
const g = graph.find(n => n.initialTemplate === templates[6])
const h = graph.find(n => n.initialTemplate === templates[7])
const i = graph.find(n => n.initialTemplate === templates[8])
const a = graph.find((n) => n.initialTemplate === templates[0])
const b = graph.find((n) => n.initialTemplate === templates[1])
const c = graph.find((n) => n.initialTemplate === templates[2])
const d = graph.find((n) => n.initialTemplate === templates[3])
const e = graph.find((n) => n.initialTemplate === templates[4])
const f = graph.find((n) => n.initialTemplate === templates[5])
const g = graph.find((n) => n.initialTemplate === templates[6])
const h = graph.find((n) => n.initialTemplate === templates[7])
const i = graph.find((n) => n.initialTemplate === templates[8])
expect(new Set(a.parents)).toEqual(new Set([]))
expect(new Set(a.children)).toEqual(new Set([b, c]))
@ -384,7 +384,7 @@ describe('hydrateTemplates', () => {
const result = await hydrateTemplates(templates, [], {fetcher: fakeFetcher})
expect(result.find(t => t.id === 'a').values).toContainEqual({
expect(result.find((t) => t.id === 'a').values).toContainEqual({
value: 'success',
type: TemplateValueType.MetaQuery,
selected: true,

View File

@ -195,7 +195,10 @@ describe('buildInfluxQLQuery', () => {
database: 'db1',
retentionPolicy: 'rp1',
measurement: 'm0',
fields: [{value: 'f0', type: 'field'}, {value: 'f1', type: 'field'}],
fields: [
{value: 'f0', type: 'field'},
{value: 'f1', type: 'field'},
],
})
timeBounds = {upper: "'2015-02-24T00:00:00Z'"}
})

View File

@ -28,7 +28,10 @@ describe('timeSeriesToDygraph', () => {
{
name: 'm1',
columns: ['time', 'f1'],
values: [[1000, 1], [2000, 2]],
values: [
[1000, 1],
[2000, 2],
],
},
],
},
@ -38,7 +41,10 @@ describe('timeSeriesToDygraph', () => {
{
name: 'm1',
columns: ['time', 'f2'],
values: [[2000, 3], [4000, 4]],
values: [
[2000, 3],
[4000, 4],
],
},
],
},
@ -80,7 +86,11 @@ describe('timeSeriesToDygraph', () => {
{
name: 'm1',
columns: ['time', 'f1'],
values: [[100, 1], [3000, 3], [200, 2]],
values: [
[100, 1],
[3000, 3],
[200, 2],
],
},
],
},
@ -93,7 +103,11 @@ describe('timeSeriesToDygraph', () => {
const expected = {
labels: ['time', 'm1.f1'],
timeSeries: [[new Date(100), 1], [new Date(200), 2], [new Date(3000), 3]],
timeSeries: [
[new Date(100), 1],
[new Date(200), 2],
[new Date(3000), 3],
],
}
expect(actual.timeSeries).toEqual(expected.timeSeries)
@ -110,7 +124,10 @@ describe('timeSeriesToDygraph', () => {
{
name: 'm1',
columns: ['time', 'f1'],
values: [[1000, 1], [2000, 2]],
values: [
[1000, 1],
[2000, 2],
],
},
],
},
@ -126,7 +143,10 @@ describe('timeSeriesToDygraph', () => {
{
name: 'm1',
columns: ['time', 'f1'],
values: [[2000, 3], [4000, 4]],
values: [
[2000, 3],
[4000, 4],
],
},
],
},
@ -164,7 +184,10 @@ describe('timeSeriesToDygraph', () => {
{
name: 'mb',
columns: ['time', 'f1'],
values: [[1000, 1], [2000, 2]],
values: [
[1000, 1],
[2000, 2],
],
},
],
},
@ -174,7 +197,10 @@ describe('timeSeriesToDygraph', () => {
{
name: 'ma',
columns: ['time', 'f1'],
values: [[1000, 1], [2000, 2]],
values: [
[1000, 1],
[2000, 2],
],
},
],
},
@ -184,7 +210,10 @@ describe('timeSeriesToDygraph', () => {
{
name: 'mc',
columns: ['time', 'f2'],
values: [[2000, 3], [4000, 4]],
values: [
[2000, 3],
[4000, 4],
],
},
],
},
@ -194,7 +223,10 @@ describe('timeSeriesToDygraph', () => {
{
name: 'mc',
columns: ['time', 'f1'],
values: [[2000, 3], [4000, 4]],
values: [
[2000, 3],
[4000, 4],
],
},
],
},
@ -222,7 +254,11 @@ it('parses a single field influxQL query', () => {
{
name: 'm1',
columns: ['time', 'f1'],
values: [[100, 1], [3000, 3], [200, 2]],
values: [
[100, 1],
[3000, 3],
[200, 2],
],
},
],
},
@ -233,7 +269,12 @@ it('parses a single field influxQL query', () => {
const actual = timeSeriesToTableGraph(influxResponse)
const expected = [['time', 'm1.f1'], [100, 1], [200, 2], [3000, 3]]
const expected = [
['time', 'm1.f1'],
[100, 1],
[200, 2],
[3000, 3],
]
expect(actual.data).toEqual(expected)
expect(actual.influxQLQueryType).toEqual(InfluxQLQueryType.DataQuery)
@ -788,7 +829,11 @@ it('errors when both meta query and data query response', () => {
{
name: 'm1',
columns: ['time', 'f1'],
values: [[100, 1], [3000, 3], [200, 2]],
values: [
[100, 1],
[3000, 3],
[200, 2],
],
},
],
},
@ -812,7 +857,10 @@ describe('timeSeriesToTableGraph', () => {
{
name: 'mb',
columns: ['time', 'f1'],
values: [[1000, 1], [2000, 2]],
values: [
[1000, 1],
[2000, 2],
],
},
],
},
@ -822,7 +870,10 @@ describe('timeSeriesToTableGraph', () => {
{
name: 'ma',
columns: ['time', 'f1'],
values: [[1000, 1], [2000, 2]],
values: [
[1000, 1],
[2000, 2],
],
},
],
},
@ -832,7 +883,10 @@ describe('timeSeriesToTableGraph', () => {
{
name: 'mc',
columns: ['time', 'f2'],
values: [[2000, 3], [4000, 4]],
values: [
[2000, 3],
[4000, 4],
],
},
],
},
@ -842,7 +896,10 @@ describe('timeSeriesToTableGraph', () => {
{
name: 'mc',
columns: ['time', 'f1'],
values: [[2000, 3], [4000, 4]],
values: [
[2000, 3],
[4000, 4],
],
},
],
},
@ -873,7 +930,10 @@ describe('timeSeriesToTableGraph', () => {
{
name: 'mb',
columns: ['time', 'f1'],
values: [[1000, 1], [2000, 2]],
values: [
[1000, 1],
[2000, 2],
],
},
],
},
@ -883,7 +943,10 @@ describe('timeSeriesToTableGraph', () => {
{
name: 'ma',
columns: ['time', 'f1'],
values: [[1000, 1], [2000, 2]],
values: [
[1000, 1],
[2000, 2],
],
},
],
},
@ -893,7 +956,10 @@ describe('timeSeriesToTableGraph', () => {
{
name: 'mc',
columns: ['time', 'f2'],
values: [[2000, 3], [4000, 4]],
values: [
[2000, 3],
[4000, 4],
],
},
],
},
@ -903,7 +969,10 @@ describe('timeSeriesToTableGraph', () => {
{
name: 'mc',
columns: ['time', 'f1'],
values: [[2000, 3], [4000, 4]],
values: [
[2000, 3],
[4000, 4],
],
},
],
},
@ -1124,7 +1193,12 @@ describe('transformTableData', () => {
decimalPlaces
)
const expected = [['time', 'f2'], [1000, 2000], [2000, 3000], [3000, 1000]]
const expected = [
['time', 'f2'],
[1000, 2000],
[2000, 3000],
[3000, 1000],
]
expect(actual.transformedData).toEqual(expected)
})
@ -1161,7 +1235,12 @@ describe('transformTableData', () => {
decimalPlaces
)
const expected = [['time', 'f2'], [2000, 3000], [3000, 1000], [1000, 2000]]
const expected = [
['time', 'f2'],
[2000, 3000],
[3000, 1000],
[1000, 2000],
]
expect(actual.transformedData).toEqual(expected)
})
@ -1241,7 +1320,10 @@ describe('if verticalTimeAxis is false', () => {
decimalPlaces
)
const expected = [['time', 2000, 3000, 1000], ['f2', 3000, 1000, 2000]]
const expected = [
['time', 2000, 3000, 1000],
['f2', 3000, 1000, 2000],
]
expect(actual.transformedData).toEqual(expected)
})