Update jest monorepo to v29 (#58261)

* Update jest monorepo to v29

* update snapshots + wrap test in act

* fix linting errors: jest.mocked now defaults to deep mocking

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
renovate[bot] 2022-11-24 14:00:41 +00:00 committed by GitHub
parent 8e6d343981
commit e84a01e870
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
91 changed files with 11654 additions and 11597 deletions

View File

@ -7,7 +7,7 @@ module.exports = {
verbose: false,
testEnvironment: 'jsdom',
transform: {
'^.+\\.(ts|tsx|js|jsx)$': require.resolve('ts-jest'),
'^.+\\.(ts|tsx|js|jsx)$': [require.resolve('ts-jest'), { isolatedModules: true }],
},
transformIgnorePatterns: [
'node_modules/(?!(ol)/)', // <- exclude the open layers library
@ -22,7 +22,6 @@ module.exports = {
setupFilesAfterEnv: ['./public/test/setupTests.ts'],
snapshotSerializers: ['enzyme-to-json/serializer'],
globals: {
'ts-jest': { isolatedModules: true },
__webpack_public_path__: '', // empty string
},
moduleNameMapper: {

View File

@ -125,7 +125,7 @@
"@types/gtag.js": "^0.0.12",
"@types/history": "4.7.11",
"@types/hoist-non-react-statics": "3.3.1",
"@types/jest": "28.1.6",
"@types/jest": "29.2.3",
"@types/jquery": "3.5.14",
"@types/js-yaml": "^4.0.5",
"@types/jsurl": "^1.2.28",
@ -165,7 +165,7 @@
"@typescript-eslint/parser": "5.42.0",
"@wojtekmaj/enzyme-adapter-react-17": "0.7.0",
"autoprefixer": "10.4.13",
"babel-jest": "28.1.3",
"babel-jest": "29.3.1",
"babel-loader": "9.1.0",
"babel-plugin-angularjs-annotate": "0.10.0",
"babel-plugin-macros": "3.1.0",
@ -195,13 +195,13 @@
"http-server": "14.1.1",
"husky": "8.0.1",
"i18next-parser": "6.6.0",
"jest": "28.1.3",
"jest": "29.3.1",
"jest-canvas-mock": "2.4.0",
"jest-date-mock": "1.0.8",
"jest-environment-jsdom": "28.1.3",
"jest-environment-jsdom": "29.3.1",
"jest-fail-on-console": "3.0.2",
"jest-junit": "14.0.1",
"jest-matcher-utils": "28.1.3",
"jest-matcher-utils": "29.3.1",
"lerna": "5.5.4",
"lint-staged": "13.0.3",
"mini-css-extract-plugin": "2.6.1",
@ -230,7 +230,7 @@
"stylelint-config-sass-guidelines": "9.0.1",
"terser-webpack-plugin": "5.3.6",
"testing-library-selector": "0.2.1",
"ts-jest": "28.0.7",
"ts-jest": "29.0.3",
"ts-loader": "9.3.1",
"ts-node": "10.9.1",
"typescript": "4.8.4",

View File

@ -66,7 +66,7 @@
"@testing-library/react-hooks": "8.0.1",
"@testing-library/user-event": "14.4.3",
"@types/history": "4.7.11",
"@types/jest": "28.1.6",
"@types/jest": "29.2.3",
"@types/jquery": "3.5.14",
"@types/lodash": "4.14.187",
"@types/marked": "4.0.7",

View File

@ -40,14 +40,14 @@ describe('Array DataFrame', () => {
test('Should convert an array of objects to a dataframe', () => {
expect(toDataFrameDTO(frame)).toMatchInlineSnapshot(`
Object {
"fields": Array [
Object {
"config": Object {},
{
"fields": [
{
"config": {},
"labels": undefined,
"name": "name",
"type": "string",
"values": Array [
"values": [
"first",
"second",
"third",
@ -55,14 +55,14 @@ describe('Array DataFrame', () => {
"5th (Null)",
],
},
Object {
"config": Object {
{
"config": {
"unit": "kwh",
},
"labels": undefined,
"name": "value",
"type": "number",
"values": Array [
"values": [
1,
2,
3,
@ -70,12 +70,12 @@ describe('Array DataFrame', () => {
null,
],
},
Object {
"config": Object {},
{
"config": {},
"labels": undefined,
"name": "time",
"type": "time",
"values": Array [
"values": [
123,
456,
789,
@ -83,12 +83,12 @@ describe('Array DataFrame', () => {
1100,
],
},
Object {
"config": Object {},
{
"config": {},
"labels": undefined,
"name": "phantom",
"type": "string",
"values": Array [
"values": [
"🦥",
"🦥",
"🦥",

View File

@ -29,50 +29,50 @@ describe('DataFrame JSON', () => {
const frame = dataFrameFromJSON(json);
expect(frame).toMatchInlineSnapshot(`
Object {
"fields": Array [
Object {
"config": Object {},
"entities": Object {},
{
"fields": [
{
"config": {},
"entities": {},
"name": "time",
"type": "time",
"values": Array [
"values": [
100,
200,
300,
],
},
Object {
"config": Object {},
"entities": Object {
"Inf": Array [
{
"config": {},
"entities": {
"Inf": [
1,
],
"NaN": Array [
"NaN": [
0,
],
"Undef": Array [
"Undef": [
2,
],
},
"name": "name",
"type": "string",
"values": Array [
"values": [
NaN,
Infinity,
undefined,
],
},
Object {
"config": Object {},
"entities": Object {
"NegInf": Array [
{
"config": {},
"entities": {
"NegInf": [
2,
],
},
"name": "value",
"type": "number",
"values": Array [
"values": [
1,
2,
-Infinity,
@ -106,26 +106,26 @@ describe('DataFrame JSON', () => {
const frame = dataFrameFromJSON(json);
expect(frame).toMatchInlineSnapshot(`
Object {
"fields": Array [
Object {
"config": Object {},
"entities": Object {},
{
"fields": [
{
"config": {},
"entities": {},
"name": "time",
"type": "time",
"values": Array [
"values": [
100,
200,
300,
400,
],
},
Object {
"config": Object {},
"entities": Object {},
{
"config": {},
"entities": {},
"name": "value",
"type": "string",
"values": Array [
"values": [
"bar",
"foo",
"baz",

View File

@ -199,16 +199,16 @@ describe('toDataFrame', () => {
};
const dataFrame = toDataFrame(msg);
expect(dataFrame.fields.map((f) => ({ [f.name]: f.values.toArray() }))).toMatchInlineSnapshot(`
Array [
Object {
"First": Array [
[
{
"First": [
"2019-02-15",
"2019-03-15",
"2019-04-15",
],
},
Object {
"Second": Array [
{
"Second": [
3,
9,
16,

View File

@ -186,29 +186,29 @@ describe('applyFieldOverrides', () => {
});
expect(withOverrides[0].fields[0].state!.scopedVars).toMatchInlineSnapshot(`
Object {
"__field": Object {
"text": "Field",
"value": Object {},
},
"__series": Object {
"text": "Series",
"value": Object {
"name": "A",
},
},
}
`);
{
"__field": {
"text": "Field",
"value": {},
},
"__series": {
"text": "Series",
"value": {
"name": "A",
},
},
}
`);
expect(withOverrides[1].fields[0].state!.scopedVars).toMatchInlineSnapshot(`
Object {
"__field": Object {
{
"__field": {
"text": "Field",
"value": Object {},
"value": {},
},
"__series": Object {
"__series": {
"text": "Series",
"value": Object {
"value": {
"name": "B",
},
},
@ -384,8 +384,8 @@ describe('setFieldConfigDefaults', () => {
setFieldConfigDefaults(dsFieldConfig, panelFieldConfig, context);
expect(dsFieldConfig).toMatchInlineSnapshot(`
Object {
"custom": Object {},
{
"custom": {},
"decimals": 2,
"max": 100,
"min": 0,
@ -419,8 +419,8 @@ describe('setFieldConfigDefaults', () => {
setFieldConfigDefaults(dsFieldConfig, panelFieldConfig, context);
expect(dsFieldConfig).toMatchInlineSnapshot(`
Object {
"custom": Object {
{
"custom": {
"property1": 10,
"property2": 10,
},

View File

@ -208,12 +208,12 @@ describe('calculateField transformer w/ timeseries', () => {
const filtered = data[0];
const rows = new DataFrameView(filtered).toArray();
expect(rows).toMatchInlineSnapshot(`
Array [
Object {
[
{
"E * 1": 1,
"TheTime": 1000,
},
Object {
{
"E * 1": 0,
"TheTime": 2000,
},
@ -267,12 +267,12 @@ describe('calculateField transformer w/ timeseries', () => {
const filtered = data[0];
const rows = new DataFrameView(filtered).toArray();
expect(rows).toMatchInlineSnapshot(`
Array [
Object {
[
{
"Test": 6,
"TheTime": 1000,
},
Object {
{
"Test": 105,
"TheTime": 2000,
},

View File

@ -25,28 +25,28 @@ describe('Concat Transformer', () => {
const frame = concatenateFields([simpleABC, simpleXYZ], { frameNameMode: ConcatenateFrameNameMode.Drop });
expect(frame.length).toBe(3);
expect(frame.fields.map((f) => ({ name: f.name, labels: f.labels }))).toMatchInlineSnapshot(`
Array [
Object {
[
{
"labels": undefined,
"name": "A",
},
Object {
{
"labels": undefined,
"name": "B",
},
Object {
{
"labels": undefined,
"name": "C",
},
Object {
{
"labels": undefined,
"name": "X",
},
Object {
{
"labels": undefined,
"name": "Y",
},
Object {
{
"labels": undefined,
"name": "Z",
},
@ -58,28 +58,28 @@ describe('Concat Transformer', () => {
const frame = concatenateFields([simpleABC, simpleXYZ], { frameNameMode: ConcatenateFrameNameMode.FieldName });
expect(frame.length).toBe(3);
expect(frame.fields.map((f) => ({ name: f.name, labels: f.labels }))).toMatchInlineSnapshot(`
Array [
Object {
[
{
"labels": undefined,
"name": "ABC · A",
},
Object {
{
"labels": undefined,
"name": "ABC · B",
},
Object {
{
"labels": undefined,
"name": "ABC · C",
},
Object {
{
"labels": undefined,
"name": "XYZ · X",
},
Object {
{
"labels": undefined,
"name": "XYZ · Y",
},
Object {
{
"labels": undefined,
"name": "XYZ · Z",
},
@ -94,39 +94,39 @@ describe('Concat Transformer', () => {
});
expect(frame.length).toBe(3);
expect(frame.fields.map((f) => ({ name: f.name, labels: f.labels }))).toMatchInlineSnapshot(`
Array [
Object {
"labels": Object {
[
{
"labels": {
"sensor": "ABC",
},
"name": "A",
},
Object {
"labels": Object {
{
"labels": {
"sensor": "ABC",
},
"name": "B",
},
Object {
"labels": Object {
{
"labels": {
"sensor": "ABC",
},
"name": "C",
},
Object {
"labels": Object {
{
"labels": {
"sensor": "XYZ",
},
"name": "X",
},
Object {
"labels": Object {
{
"labels": {
"sensor": "XYZ",
},
"name": "Y",
},
Object {
"labels": Object {
{
"labels": {
"sensor": "XYZ",
},
"name": "Z",

View File

@ -51,66 +51,66 @@ describe('ensureColumns transformer', () => {
const frame = filtered[0];
expect(frame.fields.length).toEqual(5);
expect(filtered[0]).toMatchInlineSnapshot(`
Object {
"fields": Array [
Object {
"config": Object {},
{
"fields": [
{
"config": {},
"name": "TheTime",
"state": Object {},
"state": {},
"type": "time",
"values": Array [
"values": [
1000,
2000,
],
},
Object {
"config": Object {},
"labels": Object {},
{
"config": {},
"labels": {},
"name": "A",
"state": Object {},
"state": {},
"type": "number",
"values": Array [
"values": [
1,
100,
],
},
Object {
"config": Object {},
"labels": Object {},
{
"config": {},
"labels": {},
"name": "B",
"state": Object {},
"state": {},
"type": "number",
"values": Array [
"values": [
2,
200,
],
},
Object {
"config": Object {},
"labels": Object {},
{
"config": {},
"labels": {},
"name": "C",
"state": Object {},
"state": {},
"type": "number",
"values": Array [
"values": [
3,
300,
],
},
Object {
"config": Object {},
"labels": Object {},
{
"config": {},
"labels": {},
"name": "D",
"state": Object {},
"state": {},
"type": "string",
"values": Array [
"values": [
"first",
"second",
],
},
],
"length": 2,
"meta": Object {
"transformations": Array [
"meta": {
"transformations": [
"ensureColumns",
],
},

View File

@ -128,34 +128,34 @@ describe('Grouping to Matrix', () => {
const processed = received[0];
expect(processed[0].fields).toMatchInlineSnapshot(`
Array [
Object {
"config": Object {},
"name": "Row\\\\Column",
[
{
"config": {},
"name": "Row\\Column",
"type": "string",
"values": Array [
"values": [
"R1",
"R2",
],
},
Object {
"config": Object {
{
"config": {
"units": "celsius",
},
"name": "C1",
"type": "number",
"values": Array [
"values": [
1,
4,
],
},
Object {
"config": Object {
{
"config": {
"units": "celsius",
},
"name": "C2",
"type": "number",
"values": Array [
"values": [
5,
"",
],

View File

@ -30,13 +30,13 @@ describe('histogram frames frames', () => {
config: f.config,
}))
).toMatchInlineSnapshot(`
Array [
Object {
"config": Object {
[
{
"config": {
"unit": "mph",
},
"name": "BucketMin",
"values": Array [
"values": [
1,
2,
3,
@ -48,12 +48,12 @@ describe('histogram frames frames', () => {
9,
],
},
Object {
"config": Object {
{
"config": {
"unit": "mph",
},
"name": "BucketMax",
"values": Array [
"values": [
2,
3,
4,
@ -65,12 +65,12 @@ describe('histogram frames frames', () => {
10,
],
},
Object {
"config": Object {
{
"config": {
"unit": undefined,
},
"name": "A",
"values": Array [
"values": [
1,
1,
1,
@ -82,12 +82,12 @@ describe('histogram frames frames', () => {
0,
],
},
Object {
"config": Object {
{
"config": {
"unit": undefined,
},
"name": "B",
"values": Array [
"values": [
0,
0,
1,
@ -99,12 +99,12 @@ describe('histogram frames frames', () => {
0,
],
},
Object {
"config": Object {
{
"config": {
"unit": undefined,
},
"name": "C",
"values": Array [
"values": [
0,
0,
0,
@ -116,12 +116,12 @@ describe('histogram frames frames', () => {
1,
],
},
Object {
"config": Object {
{
"config": {
"unit": undefined,
},
"name": "C",
"values": Array [
"values": [
0,
0,
0,
@ -143,10 +143,10 @@ describe('histogram frames frames', () => {
values: f.values.toArray(),
}))
).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "BucketMin",
"values": Array [
"values": [
1,
2,
3,
@ -158,9 +158,9 @@ describe('histogram frames frames', () => {
9,
],
},
Object {
{
"name": "BucketMax",
"values": Array [
"values": [
2,
3,
4,
@ -172,9 +172,9 @@ describe('histogram frames frames', () => {
10,
],
},
Object {
{
"name": "Count",
"values": Array [
"values": [
1,
1,
2,

View File

@ -36,42 +36,42 @@ describe('align frames', () => {
values: f.values.toArray(),
}))
).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "TheTime",
"values": Array [
"values": [
1000,
1500,
2000,
],
},
Object {
{
"name": "A",
"values": Array [
"values": [
1,
undefined,
100,
],
},
Object {
{
"name": "A",
"values": Array [
"values": [
2,
20,
200,
],
},
Object {
{
"name": "B",
"values": Array [
"values": [
3,
30,
300,
],
},
Object {
{
"name": "C",
"values": Array [
"values": [
"first",
"second",
"third",
@ -89,38 +89,38 @@ describe('align frames', () => {
values: f.values.toArray(),
}))
).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "TheTime",
"values": Array [
"values": [
1000,
2000,
],
},
Object {
{
"name": "A",
"values": Array [
"values": [
1,
100,
],
},
Object {
{
"name": "A",
"values": Array [
"values": [
2,
200,
],
},
Object {
{
"name": "B",
"values": Array [
"values": [
3,
300,
],
},
Object {
{
"name": "C",
"values": Array [
"values": [
"first",
"third",
],
@ -154,44 +154,44 @@ describe('align frames', () => {
state: f.state,
}))
).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "TheTime",
"state": Object {
"origin": Object {
"state": {
"origin": {
"fieldIndex": 0,
"frameIndex": 0,
},
},
"values": Array [
"values": [
1000,
1500,
2000,
],
},
Object {
{
"name": "A1",
"state": Object {
"origin": Object {
"state": {
"origin": {
"fieldIndex": 1,
"frameIndex": 0,
},
},
"values": Array [
"values": [
1,
15,
2,
],
},
Object {
{
"name": "A2",
"state": Object {
"origin": Object {
"state": {
"origin": {
"fieldIndex": 1,
"frameIndex": 1,
},
},
"values": Array [
"values": [
1,
undefined,
2,
@ -208,20 +208,20 @@ describe('align frames', () => {
state: f.state,
}))
).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "TheTime",
"state": Object {
"origin": Object {
"state": {
"origin": {
"fieldIndex": 0,
"frameIndex": 0,
},
},
},
Object {
{
"name": "A1",
"state": Object {
"origin": Object {
"state": {
"origin": {
"fieldIndex": 1,
"frameIndex": 0,
},
@ -246,18 +246,18 @@ describe('align frames', () => {
values: f.values.toArray(),
}))
).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "TheTime",
"values": Array [
"values": [
1500,
2000,
6000,
],
},
Object {
{
"name": "A1",
"values": Array [
"values": [
15,
22,
1,
@ -293,24 +293,24 @@ describe('align frames', () => {
values: f.values.toArray(),
}))
).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "TheTime",
"values": Array [
"values": [
1000,
2000,
],
},
Object {
{
"name": "A",
"values": Array [
"values": [
1,
100,
],
},
Object {
{
"name": "A",
"values": Array [
"values": [
200,
undefined,
],

View File

@ -28,20 +28,20 @@ describe('Labels as Columns', () => {
await expect(transformDataFrame([cfg], [source])).toEmitValuesWith((received) => {
const data = received[0];
expect(toSimpleObject(data[0])).toMatchInlineSnapshot(`
Object {
"Value": Array [
{
"Value": [
1,
2,
],
"feelsLike": Array [
"feelsLike": [
"ok",
"ok",
],
"location": Array [
"location": [
"inside",
"inside",
],
"time": Array [
"time": [
1000,
2000,
],
@ -119,27 +119,27 @@ describe('Labels as Columns', () => {
expect(data.length).toEqual(2);
expect(toSimpleObject(data[0])).toMatchInlineSnapshot(`
Object {
"location": Array [
{
"location": [
"inside",
],
"temp": Array [
"temp": [
1,
],
"time": Array [
"time": [
1000,
],
}
`);
expect(toSimpleObject(data[1])).toMatchInlineSnapshot(`
Object {
"location": Array [
{
"location": [
"outside",
],
"temp": Array [
"temp": [
-1,
],
"time": Array [
"time": [
2000,
],
}
@ -196,33 +196,33 @@ describe('Labels as Columns', () => {
await expect(transformDataFrame([cfg], [source])).toEmitValuesWith((received) => {
expect(received[0][0].fields.map((f) => ({ [f.name]: f.values.toArray() }))).toMatchInlineSnapshot(`
Array [
Object {
"time": Array [
[
{
"time": [
1000,
2000,
],
},
Object {
"a": Array [
{
"a": [
1,
3,
],
},
Object {
"b": Array [
{
"b": [
2,
4,
],
},
Object {
"foo": Array [
{
"foo": [
"thing",
"thing",
],
},
Object {
"bar": Array [
{
"bar": [
"thing",
"thing",
],
@ -285,42 +285,42 @@ describe('Labels as Columns', () => {
expect(
received[0].map((f) => ({ name: f.name, fields: f.fields.map((v) => ({ [v.name]: v.values.toArray() })) }))
).toMatchInlineSnapshot(`
Array [
Object {
"fields": Array [
Object {
"label": Array [
[
{
"fields": [
{
"label": [
"foo",
"bar",
"zaz",
],
},
Object {
"value": Array [
{
"value": [
"thing",
"a",
"xyz",
],
},
],
"name": "a {bar=\\"a\\", foo=\\"thing\\", zaz=\\"xyz\\"}",
"name": "a {bar="a", foo="thing", zaz="xyz"}",
},
Object {
"fields": Array [
Object {
"label": Array [
{
"fields": [
{
"label": [
"foo",
"bar",
],
},
Object {
"value": Array [
{
"value": [
"thing",
"b",
],
},
],
"name": "b {bar=\\"b\\", foo=\\"thing\\"}",
"name": "b {bar="b", foo="thing"}",
},
]
`);
@ -349,40 +349,40 @@ describe('Labels as Columns', () => {
expect(
received[0].map((f) => ({ name: f.name, fields: f.fields.map((v) => ({ [v.name]: v.values.toArray() })) }))
).toMatchInlineSnapshot(`
Array [
Object {
"fields": Array [
Object {
"label": Array [
[
{
"fields": [
{
"label": [
"zaz",
"bar",
],
},
Object {
"value": Array [
{
"value": [
"xyz",
"a",
],
},
],
"name": "a {bar=\\"a\\", foo=\\"thing\\", zaz=\\"xyz\\"}",
"name": "a {bar="a", foo="thing", zaz="xyz"}",
},
Object {
"fields": Array [
Object {
"label": Array [
{
"fields": [
{
"label": [
"zaz",
"bar",
],
},
Object {
"value": Array [
{
"value": [
undefined,
"b",
],
},
],
"name": "b {bar=\\"b\\", foo=\\"thing\\"}",
"name": "b {bar="b", foo="thing"}",
},
]
`);

View File

@ -264,12 +264,12 @@ describe('Reducer Transformer', () => {
const view0 = new DataFrameView<any>(frames[0]);
const view1 = new DataFrameView<any>(frames[1]);
expect({ ...view0.get(0) }).toMatchInlineSnapshot(`
Object {
{
"temperature": 6,
}
`);
expect({ ...view1.get(0) }).toMatchInlineSnapshot(`
Object {
{
"humidity": 10000.6,
"temperature": 6,
}
@ -398,45 +398,45 @@ describe('Reducer Transformer', () => {
expect(processed.length).toEqual(1);
expect(processed[0].fields).toMatchInlineSnapshot(`
Array [
Object {
"config": Object {},
[
{
"config": {},
"name": "Field",
"type": "string",
"values": Array [
"values": [
"value",
"value",
"value",
"value",
],
},
Object {
"config": Object {},
{
"config": {},
"name": "state",
"type": "string",
"values": Array [
"values": [
"CA",
"NY",
"CA",
,
],
},
Object {
"config": Object {},
{
"config": {},
"name": "country",
"type": "string",
"values": Array [
"values": [
,
,
"USA",
"USA",
],
},
Object {
"config": Object {},
{
"config": {},
"name": "Max",
"type": "number",
"values": Array [
"values": [
6,
6,
6,

View File

@ -42,35 +42,35 @@ describe('Rename By Regex Transformer', () => {
const data = received[0];
const frame = data[0];
expect(frame.fields).toMatchInlineSnapshot(`
Array [
Object {
"config": Object {
[
{
"config": {
"name": "Time",
},
"name": "Time",
"state": Object {
"state": {
"displayName": "Time",
"multipleFrames": false,
},
"type": "time",
"values": Array [
"values": [
3000,
4000,
5000,
6000,
],
},
Object {
"config": Object {
{
"config": {
"displayName": "web-01",
},
"name": "Value",
"state": Object {
"state": {
"displayName": "web-01",
"multipleFrames": false,
},
"type": "number",
"values": Array [
"values": [
10000.3,
10000.4,
10000.5,
@ -94,36 +94,36 @@ describe('Rename By Regex Transformer', () => {
const data = received[0];
const frame = data[0];
expect(frame.fields).toMatchInlineSnapshot(`
Array [
Object {
"config": Object {
[
{
"config": {
"displayName": "TimE",
"name": "Time",
},
"name": "Time",
"state": Object {
"state": {
"displayName": "TimE",
"multipleFrames": false,
},
"type": "time",
"values": Array [
"values": [
3000,
4000,
5000,
6000,
],
},
Object {
"config": Object {
{
"config": {
"displayName": "wEb-01.ExamplE.com",
},
"name": "Value",
"state": Object {
"state": {
"displayName": "wEb-01.ExamplE.com",
"multipleFrames": false,
},
"type": "number",
"values": Array [
"values": [
10000.3,
10000.4,
10000.5,
@ -147,35 +147,35 @@ describe('Rename By Regex Transformer', () => {
const data = received[0];
const frame = data[0];
expect(frame.fields).toMatchInlineSnapshot(`
Array [
Object {
"config": Object {
[
{
"config": {
"name": "Time",
},
"name": "Time",
"state": Object {
"state": {
"displayName": "Time",
"multipleFrames": false,
},
"type": "time",
"values": Array [
"values": [
3000,
4000,
5000,
6000,
],
},
Object {
"config": Object {
{
"config": {
"displayName": "web-01.example.com",
},
"name": "Value",
"state": Object {
"state": {
"displayName": "web-01.example.com",
"multipleFrames": false,
},
"type": "number",
"values": Array [
"values": [
10000.3,
10000.4,
10000.5,
@ -199,35 +199,35 @@ describe('Rename By Regex Transformer', () => {
const data = received[0];
const frame = data[0];
expect(frame.fields).toMatchInlineSnapshot(`
Array [
Object {
"config": Object {
[
{
"config": {
"name": "Time",
},
"name": "Time",
"state": Object {
"state": {
"displayName": "Time",
"multipleFrames": false,
},
"type": "time",
"values": Array [
"values": [
3000,
4000,
5000,
6000,
],
},
Object {
"config": Object {
{
"config": {
"displayName": "web-01.example.com",
},
"name": "Value",
"state": Object {
"state": {
"displayName": "web-01.example.com",
"multipleFrames": false,
},
"type": "number",
"values": Array [
"values": [
10000.3,
10000.4,
10000.5,

View File

@ -48,9 +48,9 @@ describe('SortBy transformer', () => {
await expect(transformDataFrame([cfg], [testFrame])).toEmitValuesWith((received) => {
expect(getFieldSnapshot(received[0][0].fields[0])).toMatchInlineSnapshot(`
Object {
{
"name": "time",
"values": Array [
"values": [
5,
6,
7,
@ -78,9 +78,9 @@ describe('SortBy transformer', () => {
await expect(transformDataFrame([cfg], [testFrame])).toEmitValuesWith((received) => {
expect(getFieldSnapshot(received[0][0].fields[0])).toMatchInlineSnapshot(`
Object {
{
"name": "time",
"values": Array [
"values": [
10,
9,
8,

View File

@ -1,50 +1,50 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`read csv should get X and y 1`] = `
Object {
"fields": Array [
Object {
"config": Object {},
{
"fields": [
{
"config": {},
"labels": undefined,
"name": "Field 1",
"type": "string",
"values": Array [
"values": [
"",
"2",
"5",
"",
],
},
Object {
"config": Object {},
{
"config": {},
"labels": undefined,
"name": "Field 2",
"type": "number",
"values": Array [
"values": [
1,
3,
6,
NaN,
],
},
Object {
"config": Object {},
{
"config": {},
"labels": undefined,
"name": "Field 3",
"type": "number",
"values": Array [
"values": [
undefined,
4,
undefined,
NaN,
],
},
Object {
"config": Object {},
{
"config": {},
"labels": undefined,
"name": "Field 4",
"type": "number",
"values": Array [
"values": [
undefined,
undefined,
undefined,
@ -59,34 +59,34 @@ Object {
`;
exports[`read csv should read csv from local file system 1`] = `
Object {
"fields": Array [
Object {
"config": Object {},
{
"fields": [
{
"config": {},
"labels": undefined,
"name": "a",
"type": "number",
"values": Array [
"values": [
10,
40,
],
},
Object {
"config": Object {},
{
"config": {},
"labels": undefined,
"name": "b",
"type": "number",
"values": Array [
"values": [
20,
50,
],
},
Object {
"config": Object {},
{
"config": {},
"labels": undefined,
"name": "c",
"type": "number",
"values": Array [
"values": [
30,
60,
],
@ -99,44 +99,44 @@ Object {
`;
exports[`read csv should read csv with headers 1`] = `
Object {
"fields": Array [
Object {
"config": Object {
{
"fields": [
{
"config": {
"unit": "ms",
},
"labels": undefined,
"name": "a",
"type": "number",
"values": Array [
"values": [
10,
40,
40,
40,
],
},
Object {
"config": Object {
{
"config": {
"unit": "lengthm",
},
"labels": undefined,
"name": "b",
"type": "number",
"values": Array [
"values": [
20,
50,
500,
50,
],
},
Object {
"config": Object {
{
"config": {
"unit": "s",
},
"labels": undefined,
"name": "c",
"type": "boolean",
"values": Array [
"values": [
true,
false,
false,

View File

@ -102,7 +102,7 @@ describe('write csv', () => {
const csv = toCSV([dataFrame], { useExcelHeader: true });
expect(csv).toMatchInlineSnapshot(`
"sep=,
\\"Time\\",\\"Value\\"
"Time","Value"
1598784913123,1234
1598784914123,5678
@ -130,7 +130,7 @@ describe('DataFrame to CSV', () => {
const csv = toCSV([dataFrame]);
expect(csv).toMatchInlineSnapshot(`
"\\"Time\\",\\"{label1=\\"\\"value1\\"\\", label2=\\"\\"value1\\"\\"}\\"
""Time","{label1=""value1"", label2=""value1""}"
1589455688623,1234
"
@ -159,7 +159,7 @@ describe('DataFrame to CSV', () => {
const csv = toCSV([dataFrame]);
expect(csv).toMatchInlineSnapshot(`
"\\"Time\\",\\"Value\\"
""Time","Value"
1589455688623,2020-05-14 11:28:08
"

View File

@ -56,7 +56,7 @@
"@testing-library/user-event": "14.4.3",
"@types/angular": "1.8.4",
"@types/history": "4.7.11",
"@types/jest": "28.1.6",
"@types/jest": "29.2.3",
"@types/lodash": "4.14.187",
"@types/react": "17.0.42",
"@types/react-dom": "17.0.14",

View File

@ -55,11 +55,11 @@ describe('DataSourceWithBackend', () => {
expect(mock.calls.length).toBe(1);
expect(args).toMatchInlineSnapshot(`
Object {
"data": Object {
"queries": Array [
Object {
"datasource": Object {
{
"data": {
"queries": [
{
"datasource": {
"type": "dummy",
"uid": "abc",
},
@ -68,8 +68,8 @@ describe('DataSourceWithBackend', () => {
"maxDataPoints": 10,
"refId": "A",
},
Object {
"datasource": Object {
{
"datasource": {
"type": "sample",
"uid": "<mockuid>",
},
@ -80,7 +80,7 @@ describe('DataSourceWithBackend', () => {
},
],
},
"headers": Object {
"headers": {
"X-Dashboard-Uid": "dashA",
"X-Datasource-Uid": "abc, <mockuid>",
"X-Panel-Id": "123",
@ -122,11 +122,11 @@ describe('DataSourceWithBackend', () => {
expect(mock.calls.length).toBe(1);
expect(args).toMatchInlineSnapshot(`
Object {
"data": Object {
"queries": Array [
Object {
"datasource": Object {
{
"data": {
"queries": [
{
"datasource": {
"type": "dummy",
"uid": "abc",
},
@ -135,8 +135,8 @@ describe('DataSourceWithBackend', () => {
"maxDataPoints": 10,
"refId": "A",
},
Object {
"datasource": Object {
{
"datasource": {
"type": "sample",
"uid": "<mockuid>",
},
@ -147,7 +147,7 @@ describe('DataSourceWithBackend', () => {
},
],
},
"headers": Object {
"headers": {
"X-Dashboard-Uid": "dashA",
"X-Datasource-Uid": "abc, <mockuid>",
"X-Panel-Id": "123",

View File

@ -91,15 +91,15 @@ describe('Query Response parser', () => {
const norm = frames.map((f) => toDataFrameDTO(f));
expect(norm).toMatchInlineSnapshot(`
Array [
Object {
"fields": Array [
Object {
"config": Object {},
[
{
"fields": [
{
"config": {},
"labels": undefined,
"name": "time",
"type": "time",
"values": Array [
"values": [
1611767228473,
1611767240473,
1611767252473,
@ -108,12 +108,12 @@ describe('Query Response parser', () => {
1611767288473,
],
},
Object {
"config": Object {},
{
"config": {},
"labels": undefined,
"name": "A-series",
"type": "number",
"values": Array [
"values": [
1,
20,
90,
@ -127,14 +127,14 @@ describe('Query Response parser', () => {
"name": undefined,
"refId": "A",
},
Object {
"fields": Array [
Object {
"config": Object {},
{
"fields": [
{
"config": {},
"labels": undefined,
"name": "time",
"type": "time",
"values": Array [
"values": [
1611767228473,
1611767240473,
1611767252473,
@ -143,12 +143,12 @@ describe('Query Response parser', () => {
1611767288473,
],
},
Object {
"config": Object {},
{
"config": {},
"labels": undefined,
"name": "B-series",
"type": "number",
"values": Array [
"values": [
1,
20,
90,
@ -176,15 +176,15 @@ describe('Query Response parser', () => {
const norm = frames.map((f) => toDataFrameDTO(f));
expect(norm).toMatchInlineSnapshot(`
Array [
Object {
"fields": Array [
Object {
"config": Object {},
[
{
"fields": [
{
"config": {},
"labels": undefined,
"name": "time",
"type": "time",
"values": Array [
"values": [
1611767228473,
1611767240473,
1611767252473,
@ -193,12 +193,12 @@ describe('Query Response parser', () => {
1611767288473,
],
},
Object {
"config": Object {},
{
"config": {},
"labels": undefined,
"name": "B-series",
"type": "number",
"values": Array [
"values": [
1,
20,
90,
@ -212,14 +212,14 @@ describe('Query Response parser', () => {
"name": undefined,
"refId": "B",
},
Object {
"fields": Array [
Object {
"config": Object {},
{
"fields": [
{
"config": {},
"labels": undefined,
"name": "time",
"type": "time",
"values": Array [
"values": [
1611767228473,
1611767240473,
1611767252473,
@ -228,12 +228,12 @@ describe('Query Response parser', () => {
1611767288473,
],
},
Object {
"config": Object {},
{
"config": {},
"labels": undefined,
"name": "A-series",
"type": "number",
"values": Array [
"values": [
1,
20,
90,
@ -351,7 +351,7 @@ describe('Query Response parser', () => {
// }
const res = toDataQueryResponse(resWithError);
expect(res.error).toMatchInlineSnapshot(`
Object {
{
"message": "Hello Error",
"refId": "A",
}
@ -359,23 +359,23 @@ describe('Query Response parser', () => {
const norm = res.data.map((f) => toDataFrameDTO(f));
expect(norm).toMatchInlineSnapshot(`
Array [
Object {
"fields": Array [
Object {
"config": Object {},
[
{
"fields": [
{
"config": {},
"labels": undefined,
"name": "numbers",
"type": "number",
"values": Array [
"values": [
1,
3,
],
},
],
"meta": Object {
"notices": Array [
Object {
"meta": {
"notices": [
{
"severity": 2,
"text": "Text",
},

View File

@ -145,7 +145,7 @@
"@types/enzyme-adapter-react-16": "1.0.6",
"@types/hoist-non-react-statics": "3.3.1",
"@types/is-hotkey": "0.1.7",
"@types/jest": "28.1.6",
"@types/jest": "29.2.3",
"@types/jquery": "3.5.14",
"@types/lodash": "4.14.187",
"@types/mock-raf": "1.0.3",

View File

@ -4,7 +4,7 @@ exports[`CustomScrollbar renders correctly 1`] = `
<div
className="css-12b7m5k"
style={
Object {
{
"height": "auto",
"maxHeight": "100%",
"minHeight": "0",
@ -17,7 +17,7 @@ exports[`CustomScrollbar renders correctly 1`] = `
<div
className="scrollbar-view"
style={
Object {
{
"WebkitOverflowScrolling": "touch",
"bottom": undefined,
"left": undefined,
@ -39,7 +39,7 @@ exports[`CustomScrollbar renders correctly 1`] = `
<div
className="track-horizontal"
style={
Object {
{
"display": "none",
"height": 6,
"position": "absolute",
@ -49,7 +49,7 @@ exports[`CustomScrollbar renders correctly 1`] = `
<div
className="thumb-horizontal"
style={
Object {
{
"display": "block",
"height": "100%",
"position": "relative",
@ -60,7 +60,7 @@ exports[`CustomScrollbar renders correctly 1`] = `
<div
className="track-vertical"
style={
Object {
{
"display": "none",
"position": "absolute",
"width": 6,
@ -70,7 +70,7 @@ exports[`CustomScrollbar renders correctly 1`] = `
<div
className="thumb-vertical"
style={
Object {
{
"display": "block",
"position": "relative",
"width": "100%",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`GraphNG utils preparePlotConfigBuilder 1`] = `
Object {
"axes": Array [
Object {
{
"axes": [
{
"filter": undefined,
"font": "12px \\"Roboto\\", \\"Helvetica\\", \\"Arial\\", sans-serif",
"font": "12px "Roboto", "Helvetica", "Arial", sans-serif",
"gap": 5,
"grid": Object {
"grid": {
"show": true,
"stroke": "rgba(240, 250, 255, 0.09)",
"width": 1,
@ -21,7 +21,7 @@ Object {
"space": [Function],
"splits": undefined,
"stroke": "rgb(204, 204, 220)",
"ticks": Object {
"ticks": {
"show": true,
"size": 4,
"stroke": "rgba(240, 250, 255, 0.09)",
@ -30,11 +30,11 @@ Object {
"timeZone": "utc",
"values": [Function],
},
Object {
{
"filter": undefined,
"font": "12px \\"Roboto\\", \\"Helvetica\\", \\"Arial\\", sans-serif",
"font": "12px "Roboto", "Helvetica", "Arial", sans-serif",
"gap": 5,
"grid": Object {
"grid": {
"show": true,
"stroke": "rgba(240, 250, 255, 0.09)",
"width": 1,
@ -48,7 +48,7 @@ Object {
"space": [Function],
"splits": undefined,
"stroke": "rgb(204, 204, 220)",
"ticks": Object {
"ticks": {
"show": true,
"size": 4,
"stroke": "rgba(240, 250, 255, 0.09)",
@ -58,48 +58,48 @@ Object {
"values": [Function],
},
],
"cursor": Object {
"cursor": {
"dataIdx": [Function],
"drag": Object {
"drag": {
"setScale": false,
},
"focus": Object {
"focus": {
"prox": 30,
},
"points": Object {
"points": {
"fill": [Function],
"size": [Function],
"stroke": [Function],
"width": [Function],
},
"sync": Object {
"filters": Object {
"sync": {
"filters": {
"pub": [Function],
},
"key": "__global_",
"scales": Array [
"scales": [
"x",
"__fixed/na-na/na-na/auto/linear/na",
],
},
},
"focus": Object {
"focus": {
"alpha": 1,
},
"hooks": Object {},
"legend": Object {
"hooks": {},
"legend": {
"show": false,
},
"mode": 1,
"ms": 1,
"padding": Array [
"padding": [
[Function],
[Function],
[Function],
[Function],
],
"scales": Object {
"__fixed/na-na/na-na/auto/linear/na": Object {
"scales": {
"__fixed/na-na/na-na/auto/linear/na": {
"asinh": undefined,
"auto": true,
"dir": 1,
@ -109,7 +109,7 @@ Object {
"range": [Function],
"time": undefined,
},
"x": Object {
"x": {
"auto": false,
"dir": 1,
"ori": 0,
@ -118,12 +118,12 @@ Object {
},
},
"select": undefined,
"series": Array [
Object {
"series": [
{
"value": [Function],
},
Object {
"dash": Array [
{
"dash": [
1,
2,
],
@ -131,7 +131,7 @@ Object {
"fill": [Function],
"gaps": [Function],
"paths": [Function],
"points": Object {
"points": {
"fill": "#ff0000",
"filter": [Function],
"show": true,
@ -146,8 +146,8 @@ Object {
"value": [Function],
"width": 2,
},
Object {
"dash": Array [
{
"dash": [
1,
2,
],
@ -155,7 +155,7 @@ Object {
"fill": [Function],
"gaps": [Function],
"paths": [Function],
"points": Object {
"points": {
"fill": "#ff0000",
"filter": [Function],
"show": true,
@ -170,8 +170,8 @@ Object {
"value": [Function],
"width": 2,
},
Object {
"dash": Array [
{
"dash": [
1,
2,
],
@ -179,7 +179,7 @@ Object {
"fill": [Function],
"gaps": [Function],
"paths": [Function],
"points": Object {
"points": {
"fill": "#ff0000",
"filter": [Function],
"show": true,
@ -194,8 +194,8 @@ Object {
"value": [Function],
"width": 2,
},
Object {
"dash": Array [
{
"dash": [
1,
2,
],
@ -203,7 +203,7 @@ Object {
"fill": [Function],
"gaps": [Function],
"paths": [Function],
"points": Object {
"points": {
"fill": "#ff0000",
"filter": [Function],
"show": true,
@ -218,8 +218,8 @@ Object {
"value": [Function],
"width": 2,
},
Object {
"dash": Array [
{
"dash": [
1,
2,
],
@ -227,7 +227,7 @@ Object {
"fill": [Function],
"gaps": [Function],
"paths": [Function],
"points": Object {
"points": {
"fill": "#ff0000",
"filter": [Function],
"show": true,

View File

@ -322,20 +322,20 @@ describe('GraphNG utils', () => {
});
expect(aligndFrame).toMatchInlineSnapshot(`
Object {
"fields": Array [
Object {
"config": Object {},
{
"fields": [
{
"config": {},
"name": "time",
"state": Object {
"state": {
"nullThresholdApplied": true,
"origin": Object {
"origin": {
"fieldIndex": 0,
"frameIndex": 0,
},
},
"type": "time",
"values": Array [
"values": [
1,
1.1,
2,
@ -350,25 +350,25 @@ describe('GraphNG utils', () => {
102,
],
},
Object {
"config": Object {
"custom": Object {
{
"config": {
"custom": {
"drawStyle": "bars",
"spanNulls": -1,
},
},
"labels": Object {
"labels": {
"name": "A",
},
"name": "value",
"state": Object {
"origin": Object {
"state": {
"origin": {
"fieldIndex": 1,
"frameIndex": 0,
},
},
"type": "number",
"values": Array [
"values": [
1,
undefined,
1,
@ -383,25 +383,25 @@ describe('GraphNG utils', () => {
null,
],
},
Object {
"config": Object {
"custom": Object {
{
"config": {
"custom": {
"drawStyle": "bars",
"spanNulls": -1,
},
},
"labels": Object {
"labels": {
"name": "B",
},
"name": "value",
"state": Object {
"origin": Object {
"state": {
"origin": {
"fieldIndex": 1,
"frameIndex": 1,
},
},
"type": "number",
"values": Array [
"values": [
undefined,
undefined,
undefined,
@ -416,24 +416,24 @@ describe('GraphNG utils', () => {
null,
],
},
Object {
"config": Object {
"custom": Object {
{
"config": {
"custom": {
"drawStyle": "line",
},
},
"labels": Object {
"labels": {
"name": "B",
},
"name": "value",
"state": Object {
"origin": Object {
"state": {
"origin": {
"fieldIndex": 2,
"frameIndex": 1,
},
},
"type": "number",
"values": Array [
"values": [
undefined,
undefined,
undefined,
@ -448,24 +448,24 @@ describe('GraphNG utils', () => {
undefined,
],
},
Object {
"config": Object {
"custom": Object {
{
"config": {
"custom": {
"drawStyle": "line",
},
},
"labels": Object {
"labels": {
"name": "C",
},
"name": "value",
"state": Object {
"origin": Object {
"state": {
"origin": {
"fieldIndex": 1,
"frameIndex": 2,
},
},
"type": "number",
"values": Array [
"values": [
4,
4,
undefined,
@ -480,27 +480,27 @@ describe('GraphNG utils', () => {
undefined,
],
},
Object {
"config": Object {
"custom": Object {
{
"config": {
"custom": {
"drawStyle": "bars",
"hideFrom": Object {
"hideFrom": {
"viz": true,
},
},
},
"labels": Object {
"labels": {
"name": "C",
},
"name": "value",
"state": Object {
"origin": Object {
"state": {
"origin": {
"fieldIndex": 2,
"frameIndex": 2,
},
},
"type": "number",
"values": Array [
"values": [
4,
4,
undefined,

View File

@ -38,14 +38,14 @@ describe('sharedSingleStatMigrationHandler', () => {
sharedSingleStatMigrationHandler(panel as any);
expect((panel as any).fieldConfig).toMatchInlineSnapshot(`
Object {
"defaults": Object {
"color": Object {
{
"defaults": {
"color": {
"mode": "thresholds",
},
"decimals": 5,
"mappings": Array [
Object {
"mappings": [
{
"text": "OK",
"type": 1,
"value": "1",
@ -53,20 +53,20 @@ describe('sharedSingleStatMigrationHandler', () => {
],
"max": 100,
"min": 10,
"thresholds": Object {
"thresholds": {
"mode": "absolute",
"steps": Array [
Object {
"steps": [
{
"color": "green",
"index": 0,
"value": -Infinity,
},
Object {
{
"color": "orange",
"index": 1,
"value": 40,
},
Object {
{
"color": "red",
"index": 2,
"value": 80,
@ -75,7 +75,7 @@ describe('sharedSingleStatMigrationHandler', () => {
},
"unit": "watt",
},
"overrides": Array [],
"overrides": [],
}
`);
});
@ -110,12 +110,12 @@ describe('sharedSingleStatMigrationHandler', () => {
sharedSingleStatMigrationHandler(panel as any);
expect((panel as any).fieldConfig).toMatchInlineSnapshot(`
Object {
"defaults": Object {
{
"defaults": {
"mappings": undefined,
"thresholds": undefined,
},
"overrides": Array [],
"overrides": [],
}
`);
});
@ -145,14 +145,14 @@ describe('sharedSingleStatMigrationHandler', () => {
sharedSingleStatMigrationHandler(panel as any);
expect((panel as any).fieldConfig).toMatchInlineSnapshot(`
Object {
"defaults": Object {
{
"defaults": {
"mappings": undefined,
"max": 100,
"min": 0,
"thresholds": undefined,
},
"overrides": Array [],
"overrides": [],
}
`);
});

View File

@ -21,41 +21,41 @@ describe('UPlotConfigBuilder', () => {
it('builds default config', () => {
const builder = new UPlotConfigBuilder();
expect(builder.getConfig()).toMatchInlineSnapshot(`
Object {
"axes": Array [],
"cursor": Object {
"drag": Object {
{
"axes": [],
"cursor": {
"drag": {
"setScale": false,
},
"focus": Object {
"focus": {
"prox": 30,
},
"points": Object {
"points": {
"fill": [Function],
"size": [Function],
"stroke": [Function],
"width": [Function],
},
},
"focus": Object {
"focus": {
"alpha": 1,
},
"hooks": Object {},
"legend": Object {
"hooks": {},
"legend": {
"show": false,
},
"mode": 1,
"ms": 1,
"padding": Array [
"padding": [
[Function],
[Function],
[Function],
[Function],
],
"scales": Object {},
"scales": {},
"select": undefined,
"series": Array [
Object {
"series": [
{
"value": [Function],
},
],
@ -84,46 +84,46 @@ describe('UPlotConfigBuilder', () => {
});
expect(builder.getConfig()).toMatchInlineSnapshot(`
Object {
"axes": Array [],
"cursor": Object {
"drag": Object {
{
"axes": [],
"cursor": {
"drag": {
"setScale": false,
},
"focus": Object {
"focus": {
"prox": 30,
},
"points": Object {
"points": {
"fill": [Function],
"size": [Function],
"stroke": [Function],
"width": [Function],
},
},
"focus": Object {
"focus": {
"alpha": 1,
},
"hooks": Object {},
"legend": Object {
"hooks": {},
"legend": {
"show": false,
},
"mode": 1,
"ms": 1,
"padding": Array [
"padding": [
[Function],
[Function],
[Function],
[Function],
],
"scales": Object {
"scale-x": Object {
"scales": {
"scale-x": {
"auto": false,
"dir": 1,
"ori": 0,
"range": [Function],
"time": true,
},
"scale-y": Object {
"scale-y": {
"asinh": undefined,
"auto": true,
"dir": 1,
@ -135,8 +135,8 @@ describe('UPlotConfigBuilder', () => {
},
},
"select": undefined,
"series": Array [
Object {
"series": [
{
"value": [Function],
},
],
@ -177,39 +177,39 @@ describe('UPlotConfigBuilder', () => {
distribution: ScaleDistribution.Linear,
});
expect(builder.getConfig()).toMatchInlineSnapshot(`
Object {
"axes": Array [],
"cursor": Object {
"drag": Object {
{
"axes": [],
"cursor": {
"drag": {
"setScale": false,
},
"focus": Object {
"focus": {
"prox": 30,
},
"points": Object {
"points": {
"fill": [Function],
"size": [Function],
"stroke": [Function],
"width": [Function],
},
},
"focus": Object {
"focus": {
"alpha": 1,
},
"hooks": Object {},
"legend": Object {
"hooks": {},
"legend": {
"show": false,
},
"mode": 1,
"ms": 1,
"padding": Array [
"padding": [
[Function],
[Function],
[Function],
[Function],
],
"scales": Object {
"scale-y": Object {
"scales": {
"scale-y": {
"asinh": undefined,
"auto": true,
"dir": 1,
@ -221,8 +221,8 @@ describe('UPlotConfigBuilder', () => {
},
},
"select": undefined,
"series": Array [
Object {
"series": [
{
"value": [Function],
},
],
@ -243,39 +243,39 @@ describe('UPlotConfigBuilder', () => {
});
expect(builder.getConfig()).toMatchInlineSnapshot(`
Object {
"axes": Array [],
"cursor": Object {
"drag": Object {
{
"axes": [],
"cursor": {
"drag": {
"setScale": false,
},
"focus": Object {
"focus": {
"prox": 30,
},
"points": Object {
"points": {
"fill": [Function],
"size": [Function],
"stroke": [Function],
"width": [Function],
},
},
"focus": Object {
"focus": {
"alpha": 1,
},
"hooks": Object {},
"legend": Object {
"hooks": {},
"legend": {
"show": false,
},
"mode": 1,
"ms": 1,
"padding": Array [
"padding": [
[Function],
[Function],
[Function],
[Function],
],
"scales": Object {
"scale-y": Object {
"scales": {
"scale-y": {
"asinh": undefined,
"auto": true,
"dir": 1,
@ -287,8 +287,8 @@ describe('UPlotConfigBuilder', () => {
},
},
"select": undefined,
"series": Array [
Object {
"series": [
{
"value": [Function],
},
],
@ -310,39 +310,39 @@ describe('UPlotConfigBuilder', () => {
});
expect(builder.getConfig()).toMatchInlineSnapshot(`
Object {
"axes": Array [],
"cursor": Object {
"drag": Object {
{
"axes": [],
"cursor": {
"drag": {
"setScale": false,
},
"focus": Object {
"focus": {
"prox": 30,
},
"points": Object {
"points": {
"fill": [Function],
"size": [Function],
"stroke": [Function],
"width": [Function],
},
},
"focus": Object {
"focus": {
"alpha": 1,
},
"hooks": Object {},
"legend": Object {
"hooks": {},
"legend": {
"show": false,
},
"mode": 1,
"ms": 1,
"padding": Array [
"padding": [
[Function],
[Function],
[Function],
[Function],
],
"scales": Object {
"scale-y": Object {
"scales": {
"scale-y": {
"asinh": undefined,
"auto": true,
"dir": 1,
@ -354,8 +354,8 @@ describe('UPlotConfigBuilder', () => {
},
},
"select": undefined,
"series": Array [
Object {
"series": [
{
"value": [Function],
},
],
@ -411,19 +411,19 @@ describe('UPlotConfigBuilder', () => {
});
expect(builder.getConfig()).toMatchInlineSnapshot(`
Object {
"axes": Array [
Object {
{
"axes": [
{
"filter": undefined,
"font": "12px \\"Roboto\\", \\"Helvetica\\", \\"Arial\\", sans-serif",
"font": "12px "Roboto", "Helvetica", "Arial", sans-serif",
"gap": 5,
"grid": Object {
"grid": {
"show": false,
"stroke": "rgba(240, 250, 255, 0.09)",
"width": 1,
},
"label": "test label",
"labelFont": "12px \\"Roboto\\", \\"Helvetica\\", \\"Arial\\", sans-serif",
"labelFont": "12px "Roboto", "Helvetica", "Arial", sans-serif",
"labelGap": 8,
"labelSize": 20,
"rotate": undefined,
@ -434,49 +434,49 @@ describe('UPlotConfigBuilder', () => {
"space": [Function],
"splits": undefined,
"stroke": "rgb(204, 204, 220)",
"ticks": Object {
"ticks": {
"show": true,
"size": 4,
"stroke": "rgba(240, 250, 255, 0.09)",
"width": 1,
},
"timeZone": "browser",
"values": Array [],
"values": [],
},
],
"cursor": Object {
"drag": Object {
"cursor": {
"drag": {
"setScale": false,
},
"focus": Object {
"focus": {
"prox": 30,
},
"points": Object {
"points": {
"fill": [Function],
"size": [Function],
"stroke": [Function],
"width": [Function],
},
},
"focus": Object {
"focus": {
"alpha": 1,
},
"hooks": Object {},
"legend": Object {
"hooks": {},
"legend": {
"show": false,
},
"mode": 1,
"ms": 1,
"padding": Array [
"padding": [
[Function],
[Function],
[Function],
[Function],
],
"scales": Object {},
"scales": {},
"select": undefined,
"series": Array [
Object {
"series": [
{
"value": [Function],
},
],
@ -573,49 +573,49 @@ describe('UPlotConfigBuilder', () => {
});
expect(builder.getConfig()).toMatchInlineSnapshot(`
Object {
"axes": Array [],
"cursor": Object {
"drag": Object {
{
"axes": [],
"cursor": {
"drag": {
"setScale": false,
},
"focus": Object {
"focus": {
"prox": 30,
},
"points": Object {
"points": {
"fill": [Function],
"size": [Function],
"stroke": [Function],
"width": [Function],
},
},
"focus": Object {
"focus": {
"alpha": 1,
},
"hooks": Object {},
"legend": Object {
"hooks": {},
"legend": {
"show": false,
},
"mode": 1,
"ms": 1,
"padding": Array [
"padding": [
[Function],
[Function],
[Function],
[Function],
],
"scales": Object {},
"scales": {},
"select": undefined,
"series": Array [
Object {
"series": [
{
"value": [Function],
},
Object {
{
"facets": undefined,
"fill": [Function],
"gaps": [Function],
"paths": [Function],
"points": Object {
"points": {
"fill": "#0000ff",
"filter": undefined,
"size": 5,
@ -685,65 +685,65 @@ describe('UPlotConfigBuilder', () => {
});
expect(builder.getConfig()).toMatchInlineSnapshot(`
Object {
"axes": Array [],
"bands": Array [
Object {
{
"axes": [],
"bands": [
{
"fill": "red",
"series": Array [
"series": [
3,
2,
],
},
Object {
{
"fill": "blue",
"series": Array [
"series": [
2,
1,
],
},
],
"cursor": Object {
"drag": Object {
"cursor": {
"drag": {
"setScale": false,
},
"focus": Object {
"focus": {
"prox": 30,
},
"points": Object {
"points": {
"fill": [Function],
"size": [Function],
"stroke": [Function],
"width": [Function],
},
},
"focus": Object {
"focus": {
"alpha": 1,
},
"hooks": Object {},
"legend": Object {
"hooks": {},
"legend": {
"show": false,
},
"mode": 1,
"ms": 1,
"padding": Array [
"padding": [
[Function],
[Function],
[Function],
[Function],
],
"scales": Object {},
"scales": {},
"select": undefined,
"series": Array [
Object {
"series": [
{
"value": [Function],
},
Object {
{
"facets": undefined,
"fill": [Function],
"gaps": [Function],
"paths": [Function],
"points": Object {
"points": {
"fill": "#0000ff",
"filter": undefined,
"size": undefined,
@ -757,12 +757,12 @@ describe('UPlotConfigBuilder', () => {
"value": [Function],
"width": 1,
},
Object {
{
"facets": undefined,
"fill": [Function],
"gaps": [Function],
"paths": [Function],
"points": Object {
"points": {
"fill": "#00ff00",
"filter": undefined,
"size": 5,
@ -776,12 +776,12 @@ describe('UPlotConfigBuilder', () => {
"value": [Function],
"width": 1,
},
Object {
{
"facets": undefined,
"fill": [Function],
"gaps": [Function],
"paths": [Function],
"points": Object {
"points": {
"fill": "#ff0000",
"filter": undefined,
"size": 5,

View File

@ -31,23 +31,23 @@ describe('preparePlotData2', () => {
it('creates array from DataFrame', () => {
expect(preparePlotData2(df, getStackingGroups(df))).toMatchInlineSnapshot(`
Array [
Array [
[
[
9997,
9998,
9999,
],
Array [
[
-10,
20,
10,
],
Array [
[
10,
10,
10,
],
Array [
[
20,
20,
20,
@ -67,23 +67,23 @@ describe('preparePlotData2', () => {
],
});
expect(preparePlotData2(df, getStackingGroups(df))).toMatchInlineSnapshot(`
Array [
Array [
[
[
9997,
9998,
9999,
],
Array [
[
-10,
20,
10,
],
Array [
[
10,
10,
10,
],
Array [
[
-20,
-20,
-20,
@ -108,62 +108,62 @@ describe('preparePlotData2', () => {
],
});
expect(preparePlotData2(df, getStackingGroups(df))).toMatchInlineSnapshot(`
Array [
Array [
[
[
9997,
9998,
9999,
undefined,
],
Array [
[
-10,
20,
10,
30,
],
Array [
[
10,
10,
10,
null,
],
Array [
[
null,
-20,
-20,
-20,
],
Array [
[
-20,
-20,
-20,
null,
],
Array [
[
-20,
null,
-20,
-20,
],
Array [
[
10,
10,
10,
undefined,
],
Array [
[
undefined,
-20,
-20,
-20,
],
Array [
[
-20,
-20,
-20,
undefined,
],
Array [
[
-20,
undefined,
-20,
@ -182,23 +182,23 @@ describe('preparePlotData2', () => {
],
});
expect(preparePlotData2(df, getStackingGroups(df))).toMatchInlineSnapshot(`
Array [
Array [
[
[
9997,
9998,
9999,
],
Array [
[
-10,
undefined,
undefined,
],
Array [
[
10,
10,
10,
],
Array [
[
20,
20,
20,
@ -230,23 +230,23 @@ describe('preparePlotData2', () => {
],
});
expect(preparePlotData2(df, getStackingGroups(df))).toMatchInlineSnapshot(`
Array [
Array [
[
[
9997,
9998,
9999,
],
Array [
[
-10,
20,
10,
],
Array [
[
10,
10,
10,
],
Array [
[
20,
20,
20,
@ -277,23 +277,23 @@ describe('preparePlotData2', () => {
],
});
expect(preparePlotData2(df, getStackingGroups(df))).toMatchInlineSnapshot(`
Array [
Array [
[
[
9997,
9998,
9999,
],
Array [
[
-10,
20,
10,
],
Array [
[
10,
10,
10,
],
Array [
[
30,
30,
30,
@ -333,28 +333,28 @@ describe('preparePlotData2', () => {
],
});
expect(preparePlotData2(df, getStackingGroups(df))).toMatchInlineSnapshot(`
Array [
Array [
[
[
9997,
9998,
9999,
],
Array [
[
-10,
20,
10,
],
Array [
[
10,
10,
10,
],
Array [
[
-30,
0,
-10,
],
Array [
[
-40,
-10,
-20,
@ -401,38 +401,38 @@ describe('preparePlotData2', () => {
});
expect(preparePlotData2(df, getStackingGroups(df))).toMatchInlineSnapshot(`
Array [
Array [
[
[
9997,
9998,
9999,
],
Array [
[
-10,
20,
10,
],
Array [
[
10,
10,
10,
],
Array [
[
30,
30,
30,
],
Array [
[
1,
2,
3,
],
Array [
[
2,
4,
6,
],
Array [
[
3,
6,
9,
@ -476,33 +476,33 @@ describe('preparePlotData2', () => {
});
expect(preparePlotData2(df, getStackingGroups(df))).toMatchInlineSnapshot(`
Array [
Array [
[
[
9997,
9998,
9999,
],
Array [
[
-10,
20,
10,
],
Array [
[
10,
10,
10,
],
Array [
[
1,
2,
3,
],
Array [
[
1,
2,
3,
],
Array [
[
2,
4,
6,
@ -615,8 +615,8 @@ describe('preparePlotData2', () => {
})!;
expect(preparePlotData2(df, getStackingGroups(df))).toMatchInlineSnapshot(`
Array [
Array [
[
[
1639455966000,
1639629625944,
1639803285888,
@ -636,7 +636,7 @@ describe('preparePlotData2', () => {
1642234525104,
1642408185048,
],
Array [
[
0,
0,
0,
@ -656,7 +656,7 @@ describe('preparePlotData2', () => {
0,
0,
],
Array [
[
0,
0,
2500,
@ -676,7 +676,7 @@ describe('preparePlotData2', () => {
0,
0,
],
Array [
[
0,
0,
30500,
@ -696,7 +696,7 @@ describe('preparePlotData2', () => {
0,
0,
],
Array [
[
0,
0,
30500,
@ -716,7 +716,7 @@ describe('preparePlotData2', () => {
0,
0,
],
Array [
[
0,
0,
35500,
@ -736,7 +736,7 @@ describe('preparePlotData2', () => {
0,
0,
],
Array [
[
122,
123,
47845,
@ -756,7 +756,7 @@ describe('preparePlotData2', () => {
0,
0,
],
Array [
[
122,
123,
47845,
@ -776,7 +776,7 @@ describe('preparePlotData2', () => {
0,
0,
],
Array [
[
122,
123,
47845,
@ -796,7 +796,7 @@ describe('preparePlotData2', () => {
0,
0,
],
Array [
[
122,
123,
47845,
@ -816,7 +816,7 @@ describe('preparePlotData2', () => {
0,
0,
],
Array [
[
122,
123,
48095,
@ -836,7 +836,7 @@ describe('preparePlotData2', () => {
0,
0,
],
Array [
[
122,
123,
48095,
@ -856,7 +856,7 @@ describe('preparePlotData2', () => {
1520,
665.35,
],
Array [
[
122,
123,
48095,
@ -876,7 +876,7 @@ describe('preparePlotData2', () => {
1520,
665.35,
],
Array [
[
122,
123,
48095,
@ -896,7 +896,7 @@ describe('preparePlotData2', () => {
5120,
665.35,
],
Array [
[
122,
123,
48095,
@ -916,7 +916,7 @@ describe('preparePlotData2', () => {
6795,
665.35,
],
Array [
[
122,
123,
48095,
@ -936,7 +936,7 @@ describe('preparePlotData2', () => {
6795,
665.35,
],
Array [
[
122,
123,
48095,
@ -956,7 +956,7 @@ describe('preparePlotData2', () => {
62118.84,
14496.31,
],
Array [
[
122,
123,
48095,
@ -976,7 +976,7 @@ describe('preparePlotData2', () => {
62118.84,
14496.31,
],
Array [
[
122,
123,
48095,
@ -1020,16 +1020,16 @@ describe('auto stacking groups', () => {
});
expect(getStackingGroups(df)).toMatchInlineSnapshot(`
Array [
Object {
[
{
"dir": 1,
"series": Array [
"series": [
1,
],
},
Object {
{
"dir": 1,
"series": Array [
"series": [
2,
],
},
@ -1068,17 +1068,17 @@ describe('auto stacking groups', () => {
});
expect(getStackingGroups(df)).toMatchInlineSnapshot(`
Array [
Object {
[
{
"dir": -1,
"series": Array [
"series": [
1,
4,
],
},
Object {
{
"dir": 1,
"series": Array [
"series": [
2,
3,
],
@ -1115,10 +1115,10 @@ describe('auto stacking groups', () => {
});
expect(getStackingGroups(df)).toMatchInlineSnapshot(`
Array [
Object {
[
{
"dir": 1,
"series": Array [
"series": [
1,
2,
3,
@ -1186,34 +1186,34 @@ describe('auto stacking groups', () => {
});
expect(getStackingGroups(df)).toMatchInlineSnapshot(`
Array [
Object {
[
{
"dir": 1,
"series": Array [
"series": [
1,
],
},
Object {
{
"dir": 1,
"series": Array [
"series": [
2,
],
},
Object {
{
"dir": 1,
"series": Array [
"series": [
3,
],
},
Object {
{
"dir": 1,
"series": Array [
"series": [
4,
],
},
Object {
{
"dir": 1,
"series": Array [
"series": [
5,
],
},
@ -1239,16 +1239,16 @@ describe('auto stacking groups', () => {
});
expect(getStackingGroups(df)).toMatchInlineSnapshot(`
Array [
Object {
[
{
"dir": 1,
"series": Array [
"series": [
1,
],
},
Object {
{
"dir": 1,
"series": Array [
"series": [
2,
],
},
@ -1296,35 +1296,35 @@ describe('auto stacking groups', () => {
});
expect(getStackingGroups(df)).toMatchInlineSnapshot(`
Array [
Object {
[
{
"dir": 1,
"series": Array [
"series": [
1,
2,
],
},
Object {
{
"dir": 1,
"series": Array [
"series": [
3,
],
},
Object {
{
"dir": 1,
"series": Array [
"series": [
4,
],
},
Object {
{
"dir": 1,
"series": Array [
"series": [
5,
],
},
Object {
{
"dir": -1,
"series": Array [
"series": [
6,
],
},

View File

@ -16,7 +16,7 @@
"@types/classnames": "^2.2.7",
"@types/deep-freeze": "^0.1.1",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/jest": "28.1.6",
"@types/jest": "29.2.3",
"@types/lodash": "4.14.187",
"@types/prop-types": "15.7.5",
"@types/react": "17.0.42",

View File

@ -3,14 +3,14 @@
exports[`<ListView> shallow tests matches a snapshot 1`] = `
<div
style={
Object {
{
"position": "relative",
}
}
>
<div
style={
Object {
{
"height": 1640,
"position": "relative",
}
@ -19,7 +19,7 @@ exports[`<ListView> shallow tests matches a snapshot 1`] = `
<div
className="SomeClassName"
style={
Object {
{
"margin": 0,
"padding": 0,
"position": "absolute",
@ -31,7 +31,7 @@ exports[`<ListView> shallow tests matches a snapshot 1`] = `
data-item-key="0"
key="0"
style={
Object {
{
"height": 2,
"position": "absolute",
"top": 0,
@ -44,7 +44,7 @@ exports[`<ListView> shallow tests matches a snapshot 1`] = `
data-item-key="1"
key="1"
style={
Object {
{
"height": 4,
"position": "absolute",
"top": 2,
@ -57,7 +57,7 @@ exports[`<ListView> shallow tests matches a snapshot 1`] = `
data-item-key="2"
key="2"
style={
Object {
{
"height": 6,
"position": "absolute",
"top": 6,
@ -70,7 +70,7 @@ exports[`<ListView> shallow tests matches a snapshot 1`] = `
data-item-key="3"
key="3"
style={
Object {
{
"height": 8,
"position": "absolute",
"top": 12,
@ -83,7 +83,7 @@ exports[`<ListView> shallow tests matches a snapshot 1`] = `
data-item-key="4"
key="4"
style={
Object {
{
"height": 10,
"position": "absolute",
"top": 20,

View File

@ -1,36 +1,36 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PathElem legibility creates consumable JSON 1`] = `
Object {
{
"memberIdx": 1,
"memberOf": Object {
"memberOf": {
"focalIdx": 2,
"members": Array [
Object {
"members": [
{
"memberIdx": 0,
"operation": "firstOperation",
"service": "firstService",
"visibilityIdx": 4,
},
Object {
{
"memberIdx": 1,
"operation": "beforeOperation",
"service": "beforeService",
"visibilityIdx": 2,
},
Object {
{
"memberIdx": 2,
"operation": "focalOperation",
"service": "focalService",
"visibilityIdx": 0,
},
Object {
{
"memberIdx": 3,
"operation": "afterOperation",
"service": "afterService",
"visibilityIdx": 1,
},
Object {
{
"memberIdx": 4,
"operation": "lastOperation",
"service": "lastService",

View File

@ -19,20 +19,20 @@ describe('timeRegions', () => {
};
const regions = calculateTimesWithin(cfg, tr);
expect(regions).toMatchInlineSnapshot(`
Array [
Object {
[
{
"from": 1609779600000,
"to": 1609779600000,
},
Object {
{
"from": 1610384400000,
"to": 1610384400000,
},
Object {
{
"from": 1610989200000,
"to": 1610989200000,
},
Object {
{
"from": 1611594000000,
"to": 1611594000000,
},

View File

@ -1,28 +1,28 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PanelAlertTabContent Will render alerts belonging to panel and a button to create alert from panel queries 1`] = `
Object {
"annotations": Array [
Object {
{
"annotations": [
{
"key": "__dashboardUid__",
"value": "12",
},
Object {
{
"key": "__panelId__",
"value": "34",
},
],
"condition": "C",
"folder": Object {
"folder": {
"id": 1,
"title": "super folder",
},
"name": "mypanel",
"queries": Array [
Object {
"queries": [
{
"datasourceUid": "mock-ds-2",
"model": Object {
"datasource": Object {
"model": {
"datasource": {
"type": "prometheus",
"uid": "mock-ds-2",
},
@ -33,36 +33,36 @@ Object {
},
"queryType": "",
"refId": "A",
"relativeTimeRange": Object {
"relativeTimeRange": {
"from": 21600,
"to": 0,
},
},
Object {
{
"datasourceUid": "-100",
"model": Object {
"conditions": Array [
Object {
"evaluator": Object {
"params": Array [],
"model": {
"conditions": [
{
"evaluator": {
"params": [],
"type": "gt",
},
"operator": Object {
"operator": {
"type": "and",
},
"query": Object {
"params": Array [
"query": {
"params": [
"B",
],
},
"reducer": Object {
"params": Array [],
"reducer": {
"params": [],
"type": "last",
},
"type": "query",
},
],
"datasource": Object {
"datasource": {
"type": "__expr__",
"uid": "-100",
},
@ -75,33 +75,33 @@ Object {
"queryType": "",
"refId": "B",
},
Object {
{
"datasourceUid": "-100",
"model": Object {
"conditions": Array [
Object {
"evaluator": Object {
"params": Array [
"model": {
"conditions": [
{
"evaluator": {
"params": [
0,
],
"type": "gt",
},
"operator": Object {
"operator": {
"type": "and",
},
"query": Object {
"params": Array [
"query": {
"params": [
"C",
],
},
"reducer": Object {
"params": Array [],
"reducer": {
"params": [],
"type": "last",
},
"type": "query",
},
],
"datasource": Object {
"datasource": {
"type": "__expr__",
"uid": "-100",
},

View File

@ -1,42 +1,42 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Query and expressions reducer should add a new expression 1`] = `
Object {
"queries": Array [
Object {
{
"queries": [
{
"datasourceUid": "abc123",
"model": Object {
"model": {
"refId": "A",
},
"queryType": "query",
"refId": "A",
},
Object {
{
"datasourceUid": "-100",
"model": Object {
"conditions": Array [
Object {
"evaluator": Object {
"params": Array [
"model": {
"conditions": [
{
"evaluator": {
"params": [
0,
0,
],
"type": "gt",
},
"operator": Object {
"operator": {
"type": "and",
},
"query": Object {
"params": Array [],
"query": {
"params": [],
},
"reducer": Object {
"params": Array [],
"reducer": {
"params": [],
"type": "avg",
},
"type": "query",
},
],
"datasource": Object {
"datasource": {
"name": "Expression",
"type": "__expr__",
"uid": "__expr__",
@ -55,20 +55,20 @@ Object {
`;
exports[`Query and expressions reducer should add query 1`] = `
Object {
"queries": Array [
Object {
{
"queries": [
{
"datasourceUid": "abc123",
"model": Object {
"model": {
"refId": "A",
},
"queryType": "query",
"refId": "A",
},
Object {
{
"datasourceUid": "c8eceabb-0275-4108-8f03-8f74faf4bf6d",
"model": Object {
"datasource": Object {
"model": {
"datasource": {
"type": "prometheus",
"uid": "c8eceabb-0275-4108-8f03-8f74faf4bf6d",
},
@ -77,7 +77,7 @@ Object {
},
"queryType": "",
"refId": "B",
"relativeTimeRange": Object {
"relativeTimeRange": {
"from": 600,
"to": 0,
},
@ -87,25 +87,25 @@ Object {
`;
exports[`Query and expressions reducer should duplicate query 1`] = `
Object {
"queries": Array [
Object {
{
"queries": [
{
"datasourceUid": "abc123",
"model": Object {
"model": {
"refId": "A",
},
"queryType": "query",
"refId": "A",
},
Object {
{
"datasourceUid": "abc123",
"model": Object {
"model": {
"hide": false,
"refId": "B",
},
"queryType": "",
"refId": "B",
"relativeTimeRange": Object {
"relativeTimeRange": {
"from": 600,
"to": 0,
},
@ -115,11 +115,11 @@ Object {
`;
exports[`Query and expressions reducer should remove an expression or alert query 1`] = `
Object {
"queries": Array [
Object {
{
"queries": [
{
"datasourceUid": "abc123",
"model": Object {
"model": {
"refId": "A",
},
"queryType": "query",
@ -130,44 +130,44 @@ Object {
`;
exports[`Query and expressions reducer should rewire expressions 1`] = `
Object {
"queries": Array [
Object {
{
"queries": [
{
"datasourceUid": "abc123",
"model": Object {
"model": {
"refId": "A",
},
"queryType": "query",
"refId": "A",
},
Object {
{
"datasourceUid": "-100",
"model": Object {
"conditions": Array [
Object {
"evaluator": Object {
"params": Array [
"model": {
"conditions": [
{
"evaluator": {
"params": [
0,
0,
],
"type": "gt",
},
"operator": Object {
"operator": {
"type": "and",
},
"query": Object {
"params": Array [
"query": {
"params": [
"C",
],
},
"reducer": Object {
"params": Array [],
"reducer": {
"params": [],
"type": "avg",
},
"type": "query",
},
],
"datasource": Object {
"datasource": {
"name": "Expression",
"type": "__expr__",
"uid": "__expr__",
@ -184,36 +184,36 @@ Object {
`;
exports[`Query and expressions reducer should set data queries 1`] = `
Object {
"queries": Array [
Object {
{
"queries": [
{
"datasourceUid": "-100",
"model": Object {
"conditions": Array [
Object {
"evaluator": Object {
"params": Array [
"model": {
"conditions": [
{
"evaluator": {
"params": [
0,
0,
],
"type": "gt",
},
"operator": Object {
"operator": {
"type": "and",
},
"query": Object {
"params": Array [
"query": {
"params": [
"A",
],
},
"reducer": Object {
"params": Array [],
"reducer": {
"params": [],
"type": "avg",
},
"type": "query",
},
],
"datasource": Object {
"datasource": {
"name": "Expression",
"type": "__expr__",
"uid": "__expr__",
@ -230,36 +230,36 @@ Object {
`;
exports[`Query and expressions reducer should update an expression 1`] = `
Object {
"queries": Array [
Object {
{
"queries": [
{
"datasourceUid": "-100",
"model": Object {
"conditions": Array [
Object {
"evaluator": Object {
"params": Array [
"model": {
"conditions": [
{
"evaluator": {
"params": [
0,
0,
],
"type": "gt",
},
"operator": Object {
"operator": {
"type": "and",
},
"query": Object {
"params": Array [
"query": {
"params": [
"A",
],
},
"reducer": Object {
"params": Array [],
"reducer": {
"params": [],
"type": "avg",
},
"type": "query",
},
],
"datasource": Object {
"datasource": {
"name": "Expression",
"type": "__expr__",
"uid": "__expr__",
@ -276,44 +276,44 @@ Object {
`;
exports[`Query and expressions reducer should update an expression refId and rewire expressions 1`] = `
Object {
"queries": Array [
Object {
{
"queries": [
{
"datasourceUid": "abc123",
"model": Object {
"model": {
"refId": "C",
},
"queryType": "query",
"refId": "C",
},
Object {
{
"datasourceUid": "-100",
"model": Object {
"conditions": Array [
Object {
"evaluator": Object {
"params": Array [
"model": {
"conditions": [
{
"evaluator": {
"params": [
0,
0,
],
"type": "gt",
},
"operator": Object {
"operator": {
"type": "and",
},
"query": Object {
"params": Array [
"query": {
"params": [
"C",
],
},
"reducer": Object {
"params": Array [],
"reducer": {
"params": [],
"type": "avg",
},
"type": "query",
},
],
"datasource": Object {
"datasource": {
"name": "Expression",
"type": "__expr__",
"uid": "__expr__",
@ -330,42 +330,42 @@ Object {
`;
exports[`Query and expressions reducer should update expression type 1`] = `
Object {
"queries": Array [
Object {
{
"queries": [
{
"datasourceUid": "abc123",
"model": Object {
"model": {
"refId": "A",
},
"queryType": "query",
"refId": "A",
},
Object {
{
"datasourceUid": "-100",
"model": Object {
"conditions": Array [
Object {
"evaluator": Object {
"params": Array [
"model": {
"conditions": [
{
"evaluator": {
"params": [
0,
0,
],
"type": "gt",
},
"operator": Object {
"operator": {
"type": "and",
},
"query": Object {
"params": Array [],
"query": {
"params": [],
},
"reducer": Object {
"params": Array [],
"reducer": {
"params": [],
"type": "avg",
},
"type": "query",
},
],
"datasource": Object {
"datasource": {
"name": "Expression",
"type": "__expr__",
"uid": "__expr__",

View File

@ -1,10 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`groupStateByLabels should group a list by labels 1`] = `
Object {
"{cpu=0, type=cpu}": Array [
Object {
"data": Object {},
{
"{cpu=0, type=cpu}": [
{
"data": {},
"id": "1",
"state": "alerting",
"stringifiedLabels": "{cpu=0, type=cpu}",
@ -12,9 +12,9 @@ Object {
"timestamp": 1658834395024,
},
],
"{cpu=1, type=cpu}": Array [
Object {
"data": Object {},
"{cpu=1, type=cpu}": [
{
"data": {},
"id": "2",
"state": "ok",
"stringifiedLabels": "{cpu=1, type=cpu}",
@ -26,10 +26,10 @@ Object {
`;
exports[`groupStateByLabels should group a list by labels even if the alert rule name has {} 1`] = `
Object {
"{cpu=0, type=cpu}": Array [
Object {
"data": Object {},
{
"{cpu=0, type=cpu}": [
{
"data": {},
"id": "1",
"state": "alerting",
"stringifiedLabels": "{cpu=0, type=cpu}",
@ -37,9 +37,9 @@ Object {
"timestamp": 1658834395024,
},
],
"{cpu=1, type=cpu}": Array [
Object {
"data": Object {},
"{cpu=1, type=cpu}": [
{
"data": {},
"id": "2",
"state": "ok",
"stringifiedLabels": "{cpu=1, type=cpu}",

View File

@ -1,40 +1,40 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`formValuesToRulerGrafanaRuleDTO should correctly convert rule form values 1`] = `
Object {
"annotations": Object {
{
"annotations": {
"description": "",
"runbook_url": "",
"summary": "",
},
"for": "5m",
"grafana_alert": Object {
"grafana_alert": {
"condition": "A",
"data": Array [],
"data": [],
"exec_err_state": "Error",
"no_data_state": "NoData",
"title": "",
},
"labels": Object {
"labels": {
"": "",
},
}
`;
exports[`formValuesToRulerGrafanaRuleDTO should not save both instant and range type queries 1`] = `
Object {
"annotations": Object {
{
"annotations": {
"description": "",
"runbook_url": "",
"summary": "",
},
"for": "5m",
"grafana_alert": Object {
"grafana_alert": {
"condition": "A",
"data": Array [
Object {
"data": [
{
"datasourceUid": "dsuid",
"model": Object {
"model": {
"expr": "",
"instant": false,
"range": true,
@ -42,7 +42,7 @@ Object {
},
"queryType": "query",
"refId": "A",
"relativeTimeRange": Object {
"relativeTimeRange": {
"from": 900,
"to": 1000,
},
@ -52,7 +52,7 @@ Object {
"no_data_state": "NoData",
"title": "",
},
"labels": Object {
"labels": {
"": "",
},
}

View File

@ -30,38 +30,38 @@ describe('SupportSnapshotService', () => {
const service = new SupportSnapshotService(panel);
await service.buildDebugDashboard();
expect(service.state.snapshot.panels[0].targets[0]).toMatchInlineSnapshot(`
Object {
"datasource": Object {
{
"datasource": {
"type": "grafana",
"uid": "grafana",
},
"queryType": "snapshot",
"refId": "A",
"snapshot": Array [
Object {
"data": Object {
"values": Array [
Array [
"snapshot": [
{
"data": {
"values": [
[
1,
2,
3,
],
Array [
[
11,
22,
33,
],
],
},
"schema": Object {
"fields": Array [
Object {
"config": Object {},
"schema": {
"fields": [
{
"config": {},
"name": "Time",
"type": "time",
},
Object {
"config": Object {},
{
"config": {},
"name": "Value",
"type": "number",
},

View File

@ -23,14 +23,14 @@ describe('getPanelEditorTabs selector', () => {
it('marks tab as active when tab param provided', () => {
expect(getPanelEditorTabs('transform', { meta: { skipDataQuery: false } } as PanelPlugin)).toMatchInlineSnapshot(`
Array [
Object {
[
{
"active": false,
"icon": "database",
"id": "query",
"text": "Query",
},
Object {
{
"active": true,
"icon": "process",
"id": "transform",

View File

@ -1258,15 +1258,15 @@ describe('DashboardModel', () => {
],
});
expect(model.panels[0].options).toMatchInlineSnapshot(`
Object {
"tooltip": Object {
{
"tooltip": {
"mode": "multi",
},
}
`);
expect(model.panels[1].options).toMatchInlineSnapshot(`
Object {
"tooltip": Object {
{
"tooltip": {
"mode": "single",
},
}
@ -1314,18 +1314,18 @@ describe('DashboardModel', () => {
],
});
expect(model.panels[0].fieldConfig.defaults.mappings).toMatchInlineSnapshot(`
Array [
Object {
"options": Object {
"20": Object {
[
{
"options": {
"20": {
"color": undefined,
"text": "test",
},
"30": Object {
"30": {
"color": undefined,
"text": "test1",
},
"40": Object {
"40": {
"color": "orange",
"text": "50",
},
@ -1375,11 +1375,11 @@ describe('DashboardModel', () => {
],
});
expect(model.panels[0].fieldConfig.defaults.mappings).toMatchInlineSnapshot(`
Array [
Object {
"options": Object {
[
{
"options": {
"from": 20,
"result": Object {
"result": {
"color": undefined,
"text": "text1",
},
@ -1387,10 +1387,10 @@ describe('DashboardModel', () => {
},
"type": "range",
},
Object {
"options": Object {
{
"options": {
"from": 1,
"result": Object {
"result": {
"color": undefined,
"text": "text2",
},
@ -1398,10 +1398,10 @@ describe('DashboardModel', () => {
},
"type": "range",
},
Object {
"options": Object {
{
"options": {
"from": 5,
"result": Object {
"result": {
"color": "orange",
"text": "50",
},
@ -1471,13 +1471,13 @@ describe('DashboardModel', () => {
it('should create two transormatoins', () => {
const xforms = model.panels[0].transformations;
expect(xforms).toMatchInlineSnapshot(`
Array [
Object {
[
{
"id": "labelsToFields",
},
Object {
{
"id": "merge",
"options": Object {},
"options": {},
},
]
`);
@ -1909,14 +1909,14 @@ describe('DashboardModel', () => {
});
expect(model.panels[0].fieldConfig.overrides).toMatchInlineSnapshot(`
Array [
Object {
"matcher": Object {
[
{
"matcher": {
"id": "byType",
"options": "time",
},
"properties": Array [
Object {
"properties": [
{
"id": "custom.axisPlacement",
"value": "auto",
},

View File

@ -13,7 +13,7 @@ import { PanelModel } from '../state/PanelModel';
jest.mock('app/core/services/context_srv');
const mockContextSrv = jest.mocked(contextSrv, true);
const mockContextSrv = jest.mocked(contextSrv);
variableAdapters.setInit(() => [
createQueryVariableAdapter(),

View File

@ -60,12 +60,12 @@ describe('getPanelOptionsWithDefaults', () => {
});
expect(result).toMatchInlineSnapshot(`
Object {
"fieldConfig": Object {
"defaults": Object {},
"overrides": Array [],
{
"fieldConfig": {
"defaults": {},
"overrides": [],
},
"options": Object {},
"options": {},
}
`);
});
@ -84,29 +84,29 @@ describe('getPanelOptionsWithDefaults', () => {
});
expect(result).toMatchInlineSnapshot(`
Object {
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
{
"fieldConfig": {
"defaults": {
"custom": {
"hideLines": false,
},
"thresholds": Object {
"thresholds": {
"mode": "absolute",
"steps": Array [
Object {
"steps": [
{
"color": "green",
"value": -Infinity,
},
Object {
{
"color": "red",
"value": 80,
},
],
},
},
"overrides": Array [],
"overrides": [],
},
"options": Object {
"options": {
"name": "hello",
"number": 10,
"showThresholds": true,
@ -135,21 +135,21 @@ describe('getPanelOptionsWithDefaults', () => {
});
expect(result).toMatchInlineSnapshot(`
Object {
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
{
"fieldConfig": {
"defaults": {
"custom": {
"hideLines": false,
},
"decimals": 2,
"thresholds": Object {
"thresholds": {
"mode": "absolute",
"steps": Array [
Object {
"steps": [
{
"color": "green",
"value": -Infinity,
},
Object {
{
"color": "red",
"value": 80,
},
@ -157,9 +157,9 @@ describe('getPanelOptionsWithDefaults', () => {
},
"unit": "bytes",
},
"overrides": Array [],
"overrides": [],
},
"options": Object {
"options": {
"name": "hello",
"number": 20,
"showThresholds": false,
@ -292,21 +292,21 @@ describe('getPanelOptionsWithDefaults', () => {
});
expect(result.fieldConfig.defaults).toMatchInlineSnapshot(`
Object {
"custom": Object {
{
"custom": {
"customProp": 20,
"nested": Object {
"nested": {
"nestedA": "A",
},
},
"thresholds": Object {
"thresholds": {
"mode": "absolute",
"steps": Array [
Object {
"steps": [
{
"color": "green",
"value": -Infinity,
},
Object {
{
"color": "red",
"value": 80,
},

View File

@ -20,37 +20,37 @@ describe('getPanelMenu', () => {
const menuItems = getPanelMenu(dashboard, panel);
expect(menuItems).toMatchInlineSnapshot(`
Array [
Object {
[
{
"iconClassName": "eye",
"onClick": [Function],
"shortcut": "v",
"text": "View",
},
Object {
{
"iconClassName": "edit",
"onClick": [Function],
"shortcut": "e",
"text": "Edit",
},
Object {
{
"iconClassName": "share-alt",
"onClick": [Function],
"shortcut": "p s",
"text": "Share",
},
Object {
{
"iconClassName": "compass",
"onClick": [Function],
"shortcut": "x",
"text": "Explore",
},
Object {
{
"iconClassName": "info-circle",
"onClick": [Function],
"shortcut": "i",
"subMenu": Array [
Object {
"subMenu": [
{
"onClick": [Function],
"text": "Panel JSON",
},
@ -58,20 +58,20 @@ describe('getPanelMenu', () => {
"text": "Inspect",
"type": "submenu",
},
Object {
{
"iconClassName": "cube",
"onClick": [Function],
"subMenu": Array [
Object {
"subMenu": [
{
"onClick": [Function],
"shortcut": "p d",
"text": "Duplicate",
},
Object {
{
"onClick": [Function],
"text": "Copy",
},
Object {
{
"onClick": [Function],
"text": "Create library panel",
},
@ -79,11 +79,11 @@ describe('getPanelMenu', () => {
"text": "More...",
"type": "submenu",
},
Object {
{
"text": "",
"type": "divider",
},
Object {
{
"iconClassName": "trash-alt",
"onClick": [Function],
"shortcut": "p r",
@ -104,37 +104,37 @@ describe('getPanelMenu', () => {
const menuItems = getPanelMenu(dashboard, panel, angularComponent);
expect(menuItems).toMatchInlineSnapshot(`
Array [
Object {
[
{
"iconClassName": "eye",
"onClick": [Function],
"shortcut": "v",
"text": "View",
},
Object {
{
"iconClassName": "edit",
"onClick": [Function],
"shortcut": "e",
"text": "Edit",
},
Object {
{
"iconClassName": "share-alt",
"onClick": [Function],
"shortcut": "p s",
"text": "Share",
},
Object {
{
"iconClassName": "compass",
"onClick": [Function],
"shortcut": "x",
"text": "Explore",
},
Object {
{
"iconClassName": "info-circle",
"onClick": [Function],
"shortcut": "i",
"subMenu": Array [
Object {
"subMenu": [
{
"onClick": [Function],
"text": "Panel JSON",
},
@ -142,11 +142,11 @@ describe('getPanelMenu', () => {
"text": "Inspect",
"type": "submenu",
},
Object {
{
"iconClassName": "cube",
"onClick": [Function],
"subMenu": Array [
Object {
"subMenu": [
{
"href": undefined,
"onClick": [Function],
"shortcut": "p l",

View File

@ -49,16 +49,16 @@ describe('Merge dashbaord panels', () => {
const info = dashboard.updatePanels(rawPanels);
expect(info.changed).toBeFalsy();
expect(info.actions).toMatchInlineSnapshot(`
Object {
"add": Array [],
"noop": Array [
{
"add": [],
"noop": [
1,
2,
3,
],
"remove": Array [],
"replace": Array [],
"update": Array [],
"remove": [],
"replace": [],
"update": [],
}
`);
});
@ -115,17 +115,17 @@ describe('Merge dashbaord panels', () => {
const info = dashboard.updatePanels(rawPanels);
expect(info.changed).toBeTruthy();
expect(info.actions).toMatchInlineSnapshot(`
Object {
"add": Array [],
"noop": Array [
{
"add": [],
"noop": [
1,
3,
],
"remove": Array [],
"replace": Array [
"remove": [],
"replace": [
2,
],
"update": Array [],
"update": [],
}
`);
});

View File

@ -9,7 +9,7 @@ describe('scale dimensions', () => {
max: 10,
});
expect(out).toMatchInlineSnapshot(`
Object {
{
"fixed": 7.5,
"max": 10,
"min": 5,
@ -30,7 +30,7 @@ describe('scale dimensions', () => {
}
);
expect(out).toMatchInlineSnapshot(`
Object {
{
"fixed": 10,
"max": 7,
"min": 5,

View File

@ -45,30 +45,30 @@ describe('Read GeoJSON', () => {
});
const msg = dataFrameToJSON(frame);
expect(msg.schema).toMatchInlineSnapshot(`
Object {
"fields": Array [
Object {
"config": Object {},
{
"fields": [
{
"config": {},
"name": "id",
"type": "string",
},
Object {
"config": Object {},
{
"config": {},
"name": "geo",
"type": "geo",
},
Object {
"config": Object {},
{
"config": {},
"name": "hello",
"type": "string",
},
Object {
"config": Object {},
{
"config": {},
"name": "number",
"type": "number",
},
Object {
"config": Object {},
{
"config": {},
"name": "mixed",
"type": "string",
},
@ -87,23 +87,23 @@ describe('Read GeoJSON', () => {
return acc;
}, {} as any)
).toMatchInlineSnapshot(`
Object {
"hello": Array [
{
"hello": [
"A",
"B",
null,
],
"id": Array [
"id": [
"A",
null,
null,
],
"mixed": Array [
"mixed": [
null,
"first",
"2",
],
"number": Array [
"number": [
null,
1.2,
2.3,

View File

@ -60,7 +60,7 @@ describe('Placename lookup from geojson format', () => {
const gaz = await getGazetteer('local');
expect(gaz.error).toBeUndefined();
expect(getCenterPointWGS84(gaz.find('A')?.geometry())).toMatchInlineSnapshot(`
Array [
[
0,
0,
]
@ -71,7 +71,7 @@ describe('Placename lookup from geojson format', () => {
const gaz = await getGazetteer('airports');
expect(gaz.error).toBeUndefined();
expect(getCenterPointWGS84(gaz.find('B')?.geometry())).toMatchInlineSnapshot(`
Array [
[
1,
1,
]
@ -83,7 +83,7 @@ describe('Placename lookup from geojson format', () => {
const gaz = await getGazetteer('airports');
expect(gaz.error).toBeUndefined();
expect(getCenterPointWGS84(gaz.find('C')?.geometry())).toMatchInlineSnapshot(`
Array [
[
2,
2,
]

View File

@ -23,7 +23,7 @@ describe('Placename lookup from worldmap format', () => {
const gaz = await getGazetteer('countries');
expect(gaz.error).toBeUndefined();
expect(toLonLat(gaz.find('US')?.point()?.getCoordinates()!)).toMatchInlineSnapshot(`
Array [
[
-95.712891,
37.09023999999998,
]

View File

@ -33,17 +33,17 @@ describe('handle location parsing', () => {
const info = getGeometryField(frame, matchers);
expect(info.field!.type).toBe(FieldType.geo);
expect(info.field!.values.toArray().map((p) => toLonLat((p as Point).getCoordinates()))).toMatchInlineSnapshot(`
Array [
Array [
-122.01416015625001,
36.979980468750014,
],
Array [
-73.98193359375,
40.71533203125,
],
]
`);
[
[
-122.01416015625001,
36.979980468750014,
],
[
-73.98193359375,
40.71533203125,
],
]
`);
});
it('auto should find coordinate fields', async () => {
@ -59,12 +59,12 @@ describe('handle location parsing', () => {
const matchers = await getLocationMatchers();
const geo = getGeometryField(frame, matchers).field!;
expect(geo.values.toArray().map((p) => toLonLat((p as Point).getCoordinates()))).toMatchInlineSnapshot(`
Array [
Array [
[
[
0,
0,
],
Array [
[
-74.1,
40.69999999999999,
],
@ -86,12 +86,12 @@ describe('handle location parsing', () => {
});
const geo = getGeometryField(frame, matchers).field!;
expect(geo.values.toArray().map((p) => toLonLat((p as Point).getCoordinates()))).toMatchInlineSnapshot(`
Array [
Array [
[
[
-122.01416015625001,
36.979980468750014,
],
Array [
[
-73.98193359375,
40.71533203125,
],

View File

@ -91,26 +91,26 @@ describe('Streaming JSON', () => {
it('should create frame with schema & data', () => {
expect(stream.fields.map((f) => ({ name: f.name, value: f.values.buffer }))).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "time",
"value": Array [
"value": [
100,
200,
300,
],
},
Object {
{
"name": "name",
"value": Array [
"value": [
"a",
"b",
"c",
],
},
Object {
{
"name": "value",
"value": Array [
"value": [
1,
2,
3,
@ -128,28 +128,28 @@ describe('Streaming JSON', () => {
});
expect(stream.fields.map((f) => ({ name: f.name, value: f.values.buffer }))).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "time",
"value": Array [
"value": [
100,
200,
300,
400,
],
},
Object {
{
"name": "name",
"value": Array [
"value": [
"a",
"b",
"c",
"d",
],
},
Object {
{
"name": "value",
"value": Array [
"value": [
1,
2,
3,
@ -168,28 +168,28 @@ describe('Streaming JSON', () => {
});
expect(stream.fields.map((f) => ({ name: f.name, value: f.values.buffer }))).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "time",
"value": Array [
"value": [
200,
300,
400,
500,
],
},
Object {
{
"name": "name",
"value": Array [
"value": [
"b",
"c",
"d",
"e",
],
},
Object {
{
"name": "value",
"value": Array [
"value": [
2,
3,
4,
@ -212,10 +212,10 @@ describe('Streaming JSON', () => {
});
expect(stream.fields.map((f) => ({ name: f.name, value: f.values.buffer }))).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "time",
"value": Array [
"value": [
400,
500,
501,
@ -223,9 +223,9 @@ describe('Streaming JSON', () => {
503,
],
},
Object {
{
"name": "name",
"value": Array [
"value": [
"d",
"e",
"f",
@ -233,9 +233,9 @@ describe('Streaming JSON', () => {
"h",
],
},
Object {
{
"name": "value",
"value": Array [
"value": [
4,
5,
6,
@ -264,10 +264,10 @@ describe('Streaming JSON', () => {
});
expect(stream.fields.map((f) => ({ name: f.name, value: f.values.buffer }))).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "time",
"value": Array [
"value": [
500,
501,
502,
@ -275,9 +275,9 @@ describe('Streaming JSON', () => {
601,
],
},
Object {
{
"name": "name",
"value": Array [
"value": [
"e",
"f",
"g",
@ -285,9 +285,9 @@ describe('Streaming JSON', () => {
"i",
],
},
Object {
{
"name": "value",
"value": Array [
"value": [
5,
6,
7,
@ -296,9 +296,9 @@ describe('Streaming JSON', () => {
10,
],
},
Object {
{
"name": "value2",
"value": Array [
"value": [
undefined,
undefined,
undefined,
@ -559,26 +559,26 @@ describe('Streaming JSON', () => {
]);
expect(frame.length).toEqual(3);
expect(frame.fields.map((f) => ({ name: f.name, value: f.values.buffer }))).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "time",
"value": Array [
"value": [
300,
601,
602,
],
},
Object {
{
"name": "name",
"value": Array [
"value": [
"c",
"x",
"y",
],
},
Object {
{
"name": "value",
"value": Array [
"value": [
3,
10,
11,
@ -604,24 +604,24 @@ describe('Streaming JSON', () => {
]);
expect(frame.length).toEqual(2);
expect(frame.fields.map((f) => ({ name: f.name, value: f.values.buffer }))).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "time",
"value": Array [
"value": [
601,
602,
],
},
Object {
{
"name": "name",
"value": Array [
"value": [
"x",
"y",
],
},
Object {
{
"name": "value",
"value": Array [
"value": [
10,
11,
],
@ -722,83 +722,83 @@ describe('Streaming JSON', () => {
expect(stream.fields.map((f) => ({ name: f.name, labels: f.labels, values: f.values.buffer })))
.toMatchInlineSnapshot(`
Array [
Object {
[
{
"labels": undefined,
"name": "time",
"values": Array [
"values": [
100,
200,
300,
400,
],
},
Object {
"labels": Object {
{
"labels": {
"sensor": "A",
},
"name": "speed",
"values": Array [
"values": [
10,
undefined,
30,
undefined,
],
},
Object {
"labels": Object {
{
"labels": {
"sensor": "A",
},
"name": "light",
"values": Array [
"values": [
1,
undefined,
5,
undefined,
],
},
Object {
"labels": Object {
{
"labels": {
"sensor": "B",
},
"name": "speed",
"values": Array [
"values": [
15,
20,
undefined,
undefined,
],
},
Object {
"labels": Object {
{
"labels": {
"sensor": "B",
},
"name": "light",
"values": Array [
"values": [
2,
3,
undefined,
undefined,
],
},
Object {
"labels": Object {
{
"labels": {
"sensor": "C",
},
"name": "speed",
"values": Array [
"values": [
undefined,
25,
undefined,
40,
],
},
Object {
"labels": Object {
{
"labels": {
"sensor": "C",
},
"name": "light",
"values": Array [
"values": [
undefined,
4,
undefined,
@ -817,7 +817,7 @@ describe('Streaming JSON', () => {
// names are based on legend format
expect(stream.fields.map((f) => getFieldDisplayName(f, stream, [stream]))).toMatchInlineSnapshot(`
Array [
[
"time: sensor",
"speed: A",
"light: A",
@ -860,14 +860,14 @@ describe('Streaming JSON', () => {
};
expect(getSnapshot(stream)).toMatchInlineSnapshot(`
Object {
"info": Object {
{
"info": {
"action": "replace",
"length": 3,
"number": 1,
"schemaChanged": true,
},
"values": Array [
"values": [
1,
2,
3,
@ -884,14 +884,14 @@ describe('Streaming JSON', () => {
},
});
expect(getSnapshot(stream)).toMatchInlineSnapshot(`
Object {
"info": Object {
{
"info": {
"action": "append",
"length": 2,
"number": 2,
"schemaChanged": false,
},
"values": Array [
"values": [
2,
3,
4,
@ -906,14 +906,14 @@ describe('Streaming JSON', () => {
},
});
expect(getSnapshot(stream)).toMatchInlineSnapshot(`
Object {
"info": Object {
{
"info": {
"action": "append",
"length": 1,
"number": 3,
"schemaChanged": false,
},
"values": Array [
"values": [
3,
4,
5,
@ -946,25 +946,25 @@ describe('Streaming JSON', () => {
let cTables = transpose(vrecsC);
expect(cTables).toMatchInlineSnapshot(`
Array [
Array [
[
[
"sensor=A",
"sensor=C",
],
Array [
Array [
Array [
[
[
[
300,
],
Array [
[
30,
],
],
Array [
Array [
[
[
400,
],
Array [
[
40,
],
],
@ -975,16 +975,16 @@ describe('Streaming JSON', () => {
let cJoined = join(cTables[1]);
expect(cJoined).toMatchInlineSnapshot(`
Array [
Array [
[
[
300,
400,
],
Array [
[
30,
undefined,
],
Array [
[
undefined,
40,
],

View File

@ -38,15 +38,15 @@ describe('getSnapshots', () => {
const results = await getSnapshots();
expect(results).toMatchInlineSnapshot(`
Array [
Object {
[
{
"external": true,
"externalUrl": "https://www.externalSnapshotUrl.com",
"key": "JRXqfKihKZek70FM6Xaq502NxH7OyyEs",
"name": "Snap 1",
"url": "/dashboard/snapshot/JRXqfKihKZek70FM6Xaq502NxH7OyyEs",
},
Object {
{
"external": false,
"externalUrl": "",
"id": 3,

View File

@ -120,36 +120,36 @@ describe('getFieldLinksSupplier', () => {
};
});
expect(links).toMatchInlineSnapshot(`
Array [
Object {
[
{
"href": "http://go/100.200 kW",
"title": "By Name",
},
Object {
{
"href": "http://go/100.200 kW",
"title": "By Index",
},
Object {
{
"href": "http://go/100.200 kW",
"title": "By Title",
},
Object {
{
"href": "http://go/100.2000001",
"title": "Numeric Value",
},
Object {
{
"href": "http://go/100.200",
"title": "Text (no suffix)",
},
Object {
{
"href": "http://go/\${__data.fields.XYZ}",
"title": "Unknown Field",
},
Object {
{
"href": "http://go/Hello Templates",
"title": "Data Frame name",
},
Object {
{
"href": "http://go/ZZZ",
"title": "Data Frame refId",
},

View File

@ -169,7 +169,7 @@ describe('datasource_srv', () => {
expect(ds?.name).toBe('${datasource}');
expect(ds?.uid).toBe('${datasource}');
expect(ds?.rawRef).toMatchInlineSnapshot(`
Object {
{
"type": "test-db",
"uid": "uid-code-BBB",
}
@ -193,7 +193,7 @@ describe('datasource_srv', () => {
expect(ds?.name).toBe('${datasourceDefault}');
expect(ds?.uid).toBe('${datasourceDefault}');
expect(ds?.rawRef).toMatchInlineSnapshot(`
Object {
{
"type": "test-db",
"uid": "uid-code-BBB",
}
@ -239,26 +239,26 @@ describe('datasource_srv', () => {
it('Can get list of data sources with metrics: true, builtIn: true, mixed: true', () => {
expect(dataSourceSrv.getList({ metrics: true, dashboard: true, mixed: true })).toMatchInlineSnapshot(`
Array [
Object {
"meta": Object {
[
{
"meta": {
"metrics": true,
},
"name": "aaa",
"type": "test-db",
"uid": "uid-code-aaa",
},
Object {
{
"isDefault": true,
"meta": Object {
"meta": {
"metrics": true,
},
"name": "BBB",
"type": "test-db",
"uid": "uid-code-BBB",
},
Object {
"meta": Object {
{
"meta": {
"annotations": true,
"metrics": true,
},
@ -266,16 +266,16 @@ describe('datasource_srv', () => {
"type": "test-db",
"uid": "uid-code-mmm",
},
Object {
"meta": Object {
{
"meta": {
"metrics": true,
},
"name": "ZZZ",
"type": "test-db",
"uid": "uid-code-ZZZ",
},
Object {
"meta": Object {
{
"meta": {
"builtIn": true,
"id": "mixed",
"metrics": true,
@ -284,8 +284,8 @@ describe('datasource_srv', () => {
"type": "test-db",
"uid": "-- Mixed --",
},
Object {
"meta": Object {
{
"meta": {
"builtIn": true,
"id": "dashboard",
"metrics": true,
@ -294,8 +294,8 @@ describe('datasource_srv', () => {
"type": "dashboard",
"uid": "-- Dashboard --",
},
Object {
"meta": Object {
{
"meta": {
"builtIn": true,
"id": "grafana",
"metrics": true,

View File

@ -209,12 +209,12 @@ describe('runRequest', () => {
it('should keep data for X and Y', () => {
expect(ctx.results[2].series).toMatchInlineSnapshot(`
Array [
Object {
[
{
"name": "DataX-1",
"refId": "X",
},
Object {
{
"name": "DataY-2",
"refId": "Y",
},

View File

@ -226,9 +226,9 @@ describe('updateQueries with import', () => {
expect(importSpy).toBeCalledWith(queries.map((q) => ({ ...q, exported: true })));
expect(updated).toMatchInlineSnapshot(`
Array [
Object {
"datasource": Object {
[
{
"datasource": {
"type": "new-type",
"uid": "new-uid",
},
@ -236,8 +236,8 @@ describe('updateQueries with import', () => {
"imported": true,
"refId": "A",
},
Object {
"datasource": Object {
{
"datasource": {
"type": "new-type",
"uid": "new-uid",
},
@ -349,17 +349,17 @@ describe('updateQueries with import', () => {
expect(importSpy).toBeCalledWith(queries, { uid: 'old-uid', type: 'old-type', meta: { id: 'old-type' } });
expect(updated).toMatchInlineSnapshot(`
Array [
Object {
"datasource": Object {
[
{
"datasource": {
"type": "new-type",
"uid": "new-uid",
},
"imported": true,
"refId": "A",
},
Object {
"datasource": Object {
{
"datasource": {
"type": "new-type",
"uid": "new-uid",
},

View File

@ -26,7 +26,7 @@ describe('FrontendSearcher', () => {
const results = await frontendSearcher.search(query);
expect(results.view.fields.name.values.toArray()).toMatchInlineSnapshot(`
Array [
[
"foo cat",
"bar dog",
"cow baz",
@ -44,7 +44,7 @@ describe('FrontendSearcher', () => {
const results = await frontendSearcher.search(query);
expect(results.view.fields.name.values.toArray()).toMatchInlineSnapshot(`
Array [
[
"bar dog",
"cow baz",
]
@ -61,7 +61,7 @@ describe('FrontendSearcher', () => {
const results = await frontendSearcher.search(query);
expect(results.view.fields.name.values.toArray()).toMatchInlineSnapshot(`
Array [
[
"bar dog",
]
`);

View File

@ -19,16 +19,16 @@ describe('Heatmap transformer', () => {
const heatmap = calculateHeatmapFromData([data], options);
expect(heatmap.fields.map((f) => ({ name: f.name, type: f.type, config: f.config }))).toMatchInlineSnapshot(`
Array [
Object {
"config": Object {},
[
{
"config": {},
"name": "xMin",
"type": "time",
},
Object {
"config": Object {
"custom": Object {
"scaleDistribution": Object {
{
"config": {
"custom": {
"scaleDistribution": {
"type": "linear",
},
},
@ -37,8 +37,8 @@ describe('Heatmap transformer', () => {
"name": "yMin",
"type": "number",
},
Object {
"config": Object {
{
"config": {
"unit": "short",
},
"name": "Count",
@ -60,21 +60,21 @@ describe('Heatmap transformer', () => {
const heatmap = rowsToCellsHeatmap({ frame, value: 'Speed' });
expect(heatmap.fields.map((f) => ({ name: f.name, type: f.type, config: f.config }))).toMatchInlineSnapshot(`
Array [
Object {
"config": Object {},
[
{
"config": {},
"name": "xMax",
"type": "time",
},
Object {
"config": Object {
{
"config": {
"unit": "short",
},
"name": "y",
"type": "number",
},
Object {
"config": Object {
{
"config": {
"unit": "m2",
},
"name": "Speed",
@ -83,10 +83,10 @@ describe('Heatmap transformer', () => {
]
`);
expect(heatmap.meta).toMatchInlineSnapshot(`
Object {
"custom": Object {
{
"custom": {
"yMatchWithLabel": undefined,
"yOrdinalDisplay": Array [
"yOrdinalDisplay": [
"A",
"B",
"C",
@ -96,7 +96,7 @@ describe('Heatmap transformer', () => {
}
`);
expect(heatmap.fields[1].values.toArray()).toMatchInlineSnapshot(`
Array [
[
0,
1,
2,

View File

@ -132,20 +132,20 @@ describe('value mapping from data', () => {
const results = extractConfigFromQuery(options, [config, seriesA]);
expect(results[0].fields[1].config.mappings).toMatchInlineSnapshot(`
Array [
Object {
"options": Object {
"1": Object {
[
{
"options": {
"1": {
"color": "red",
"index": 0,
"text": "one",
},
"2": Object {
"2": {
"color": "blue",
"index": 1,
"text": "two",
},
"3": Object {
"3": {
"color": "green",
"index": 2,
"text": "three",

View File

@ -21,7 +21,7 @@ describe('Fields from JSON', () => {
return acc;
}, {} as any)
).toMatchInlineSnapshot(`
Object {
{
"a": "string",
"av": "number",
"c": "string",

View File

@ -6,7 +6,7 @@ describe('Extract fields from text', () => {
const out = extractor.parse('{"a":"148.1672","av":41923755,"c":148.25}');
expect(out).toMatchInlineSnapshot(`
Object {
{
"a": "148.1672",
"av": 41923755,
"c": 148.25,
@ -18,7 +18,7 @@ describe('Extract fields from text', () => {
const extractor = fieldExtractors.get(FieldExtractorID.KeyValues);
const out = extractor.parse('a="1", "b"=\'2\',c=3 x:y ;\r\nz="d and 4"');
expect(out).toMatchInlineSnapshot(`
Object {
{
"a": "1",
"b": "2",
"c": "3",
@ -35,12 +35,12 @@ describe('Extract fields from text', () => {
);
expect(out).toMatchInlineSnapshot(`
Object {
{
"a": "1",
"b": "2",
"c": "3",
"x": "y",
"z": "dbl_quotes=\\"Double Quotes\\" sgl_quotes='Single Quotes'",
"z": "dbl_quotes="Double Quotes" sgl_quotes='Single Quotes'",
}
`);
});
@ -50,7 +50,7 @@ describe('Extract fields from text', () => {
const out = extractor.parse(`a="1", "b"=\'2\',c=3 x:y ;\r\nz="This is; testing& validating, 1=:2"`);
expect(out).toMatchInlineSnapshot(`
Object {
{
"a": "1",
"b": "2",
"c": "3",
@ -65,7 +65,7 @@ describe('Extract fields from text', () => {
const out = extractor.parse(`a=, "b"=\'2\',c=3 x: `);
expect(out).toMatchInlineSnapshot(`
Object {
{
"a": "",
"b": "2",
"c": "3",
@ -78,7 +78,7 @@ describe('Extract fields from text', () => {
const extractor = fieldExtractors.get(FieldExtractorID.KeyValues);
const out = extractor.parse('a="1", "b"=\'2\',c=3 x:y ;\r\nz="7"');
expect(out).toMatchInlineSnapshot(`
Object {
{
"a": "1",
"b": "2",
"c": "3",
@ -92,7 +92,7 @@ describe('Extract fields from text', () => {
const extractor = fieldExtractors.get(FieldExtractorID.KeyValues);
const out = extractor.parse('a=b&c=d&x=123');
expect(out).toMatchInlineSnapshot(`
Object {
{
"a": "b",
"c": "d",
"x": "123",
@ -104,7 +104,7 @@ describe('Extract fields from text', () => {
const extractor = fieldExtractors.get(FieldExtractorID.KeyValues);
const out = extractor.parse('{foo="bar", baz="42"}');
expect(out).toMatchInlineSnapshot(`
Object {
{
"baz": "42",
"foo": "bar",
}

View File

@ -55,35 +55,35 @@ describe('Join by labels', () => {
},
input
);
expect(result.fields[result.fields.length - 1].config).toMatchInlineSnapshot(`Object {}`);
expect(result.fields[result.fields.length - 1].config).toMatchInlineSnapshot(`{}`);
expect(toRowsSnapshow(result)).toMatchInlineSnapshot(`
Object {
"columns": Array [
{
"columns": [
"cluster",
"job",
"Temp",
"Speed",
],
"rows": Array [
Array [
"rows": [
[
"A",
"J1",
10,
undefined,
],
Array [
[
"A",
"J1",
200,
undefined,
],
Array [
[
"B",
"J1",
10,
22,
],
Array [
[
"B",
"J1",
200,
@ -115,21 +115,21 @@ describe('Join by labels', () => {
input
);
expect(result).toMatchInlineSnapshot(`
Object {
"fields": Array [
Object {
"config": Object {},
{
"fields": [
{
"config": {},
"name": "Error",
"type": "string",
"values": Array [
"values": [
"No labels in result",
],
},
],
"length": 0,
"meta": Object {
"notices": Array [
Object {
"meta": {
"notices": [
{
"severity": "error",
"text": "No labels in result",
},

View File

@ -36,12 +36,12 @@ describe('Lookup gazetteer', () => {
const out = await addFieldsFromGazetteer([data], gaz, matcher)[0];
expect(out.fields).toMatchInlineSnapshot(`
Array [
Object {
"config": Object {},
[
{
"config": {},
"name": "location",
"type": "string",
"values": Array [
"values": [
"AL",
"AK",
"Arizona",
@ -49,11 +49,11 @@ describe('Lookup gazetteer', () => {
"Somewhere",
],
},
Object {
"config": Object {},
{
"config": {},
"name": "id",
"type": "string",
"values": Array [
"values": [
"AL",
"AK",
,
@ -61,11 +61,11 @@ describe('Lookup gazetteer', () => {
,
],
},
Object {
"config": Object {},
{
"config": {},
"name": "name",
"type": "string",
"values": Array [
"values": [
"Alabama",
"Arkansas",
,
@ -73,11 +73,11 @@ describe('Lookup gazetteer', () => {
,
],
},
Object {
"config": Object {},
{
"config": {},
"name": "lng",
"type": "number",
"values": Array [
"values": [
-80.891064,
-100.891064,
,
@ -85,11 +85,11 @@ describe('Lookup gazetteer', () => {
,
],
},
Object {
"config": Object {},
{
"config": {},
"name": "lat",
"type": "number",
"values": Array [
"values": [
12.448457,
24.448457,
,
@ -97,15 +97,15 @@ describe('Lookup gazetteer', () => {
,
],
},
Object {
"config": Object {},
{
"config": {},
"name": "values",
"state": Object {
"state": {
"displayName": "values",
"multipleFrames": false,
},
"type": "number",
"values": Array [
"values": [
0,
10,
5,

View File

@ -85,59 +85,59 @@ describe('Prepare time series transformer', () => {
values: f.fields[1].values.toArray(),
}))
).toMatchInlineSnapshot(`
Array [
Object {
"labels": Object {
[
{
"labels": {
"region": "a",
},
"name": "wide",
"time": Array [
"time": [
1,
2,
],
"values": Array [
"values": [
10,
30,
],
},
Object {
"labels": Object {
{
"labels": {
"region": "b",
},
"name": "wide",
"time": Array [
"time": [
1,
2,
],
"values": Array [
"values": [
20,
40,
],
},
Object {
"labels": Object {
{
"labels": {
"region": "a",
},
"name": "wide",
"time": Array [
"time": [
1,
2,
],
"values": Array [
"values": [
2,
4,
],
},
Object {
"labels": Object {
{
"labels": {
"region": "b",
},
"name": "wide",
"time": Array [
"time": [
1,
2,
],
"values": Array [
"values": [
3,
5,
],

View File

@ -27,31 +27,31 @@ describe('Rows to fields', () => {
);
expect(result).toMatchInlineSnapshot(`
Object {
"fields": Array [
Object {
"config": Object {
{
"fields": [
{
"config": {
"max": 15,
"min": 3,
"unit": "degree",
},
"labels": Object {},
"labels": {},
"name": "Temperature",
"type": "number",
"values": Array [
"values": [
10,
],
},
Object {
"config": Object {
{
"config": {
"max": 200,
"min": 100,
"unit": "pressurebar",
},
"labels": Object {},
"labels": {},
"name": "Pressure",
"type": "number",
"values": Array [
"values": [
200,
],
},

View File

@ -17,5 +17,5 @@ export const createMockDatasource = (overrides?: Partial<Datasource>) => {
...overrides,
};
return jest.mocked(datasource as Datasource, true);
return jest.mocked(datasource as Datasource);
};

View File

@ -77,11 +77,11 @@ describe('SharedQueryRunner', () => {
}).subscribe((v) => {
try {
expect(v).toMatchInlineSnapshot(`
Object {
{
"annotations": undefined,
"series": Array [
Object {
"fields": Array [],
"series": [
{
"fields": [],
"length": 0,
"refId": "X",
},

View File

@ -49,5 +49,5 @@ export default function createMockDatasource(overrides?: DeepPartial<Datasource>
const mockDatasource = _mockDatasource as Datasource;
return jest.mocked(mockDatasource, true);
return jest.mocked(mockDatasource);
}

View File

@ -46,5 +46,5 @@ export default function createMockPanelData(overrides?: DeepPartial<PanelData>)
const mockPanelData = _mockPanelData as PanelData;
return jest.mocked(mockPanelData, true);
return jest.mocked(mockPanelData);
}

View File

@ -775,16 +775,16 @@ describe('AzureMonitorDatasource', () => {
})
.then((results: any) => {
expect(results.dimensions).toMatchInlineSnapshot(`
Array [
Object {
[
{
"label": "Response type",
"value": "ResponseType",
},
Object {
{
"label": "Geo type",
"value": "GeoType",
},
Object {
{
"label": "API name",
"value": "ApiName",
},

View File

@ -5,29 +5,29 @@ describe('metadata parsing', () => {
const retentions = '1s:35d:20min:5:1542274085,1min:38d:2h:1:true,10min:120d:6h:1:true,2h:2y:6h:2';
const info = parseSchemaRetentions(retentions);
expect(info).toMatchInlineSnapshot(`
Array [
Object {
[
{
"chunkspan": "20min",
"interval": "1s",
"numchunks": 5,
"ready": 1542274085,
"retention": "35d",
},
Object {
{
"chunkspan": "2h",
"interval": "1min",
"numchunks": 1,
"ready": true,
"retention": "38d",
},
Object {
{
"chunkspan": "6h",
"interval": "10min",
"numchunks": 1,
"ready": true,
"retention": "120d",
},
Object {
{
"chunkspan": "6h",
"interval": "2h",
"numchunks": 2,

View File

@ -1,4 +1,4 @@
import { render, screen } from '@testing-library/react';
import { act, render, screen } from '@testing-library/react';
import React from 'react';
import { DataSourcePluginMeta } from '@grafana/data';
@ -39,7 +39,9 @@ describe('LokiQueryBuilderContainer', () => {
render(<LokiQueryBuilderContainer {...props} />);
const selector = await screen.findByLabelText('selector');
expect(selector.textContent).toBe('{job="testjob"}');
await addOperation('Range functions', 'Rate');
await act(async () => {
await addOperation('Range functions', 'Rate');
});
expect(await screen.findByText('Rate')).toBeInTheDocument();
expect(props.onChange).toBeCalledWith({
expr: 'rate({job="testjob"} [$__interval])',

View File

@ -202,14 +202,14 @@ describe('BarChart utils', () => {
const field = displayValues.viz[0].fields[1];
expect(field.values.toArray()).toMatchInlineSnapshot(`
Array [
-10,
null,
10,
null,
null,
]
`);
[
-10,
null,
10,
null,
null,
]
`);
});
it('should sort fields when legend sortBy and sortDesc are set', () => {

View File

@ -50,29 +50,29 @@ describe('BarGauge Panel Migrations', () => {
// should mutate panel model and move field config out of panel.options
expect((panel as PanelModel).fieldConfig).toMatchInlineSnapshot(`
Object {
"defaults": Object {
"color": Object {
{
"defaults": {
"color": {
"mode": "thresholds",
},
"decimals": null,
"mappings": Array [],
"mappings": [],
"max": 33,
"min": -22,
"thresholds": Object {
"thresholds": {
"mode": "absolute",
"steps": Array [
Object {
"steps": [
{
"color": "green",
"index": 0,
"value": -Infinity,
},
Object {
{
"color": "orange",
"index": 1,
"value": 40,
},
Object {
{
"color": "red",
"index": 2,
"value": 80,
@ -81,17 +81,17 @@ describe('BarGauge Panel Migrations', () => {
},
"unit": "watt",
},
"overrides": Array [],
"overrides": [],
}
`);
// should options options
expect(newOptions).toMatchInlineSnapshot(`
Object {
{
"displayMode": "lcd",
"orientation": "vertical",
"reduceOptions": Object {
"calcs": Array [
"reduceOptions": {
"calcs": [
"mean",
],
"limit": undefined,

View File

@ -44,7 +44,7 @@ describe('Candlestick data', () => {
theme
);
expect(info?.names).toMatchInlineSnapshot(`
Object {
{
"close": "Next open",
"high": "MAX",
"low": "min",
@ -82,13 +82,13 @@ describe('Candlestick data', () => {
// Close should be offset by one and dupliate last point
expect({ open: info.open!.values.toArray(), close: info.close!.values.toArray() }).toMatchInlineSnapshot(`
Object {
"close": Array [
{
"close": [
5,
6,
6,
],
"open": Array [
"open": [
4,
5,
6,

View File

@ -89,14 +89,14 @@ describe('Gauge Panel Migrations', () => {
expect(result.reduceOptions.overrides).toBeUndefined();
expect((panel as PanelModel).fieldConfig).toMatchInlineSnapshot(`
Object {
"defaults": Object {
"color": Object {
{
"defaults": {
"color": {
"mode": "thresholds",
},
"decimals": 3,
"mappings": Array [
Object {
"mappings": [
{
"from": "50",
"id": 1,
"operator": "",
@ -108,25 +108,25 @@ describe('Gauge Panel Migrations', () => {
],
"max": "50",
"min": "-50",
"thresholds": Object {
"thresholds": {
"mode": "absolute",
"steps": Array [
Object {
"steps": [
{
"color": "green",
"index": 0,
"value": -Infinity,
},
Object {
{
"color": "#EAB839",
"index": 1,
"value": -25,
},
Object {
{
"color": "#6ED0E0",
"index": 2,
"value": 0,
},
Object {
{
"color": "red",
"index": 3,
"value": 25,
@ -135,7 +135,7 @@ describe('Gauge Panel Migrations', () => {
},
"unit": "accMS2",
},
"overrides": Array [],
"overrides": [],
}
`);
});

View File

@ -1,10 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Gauge Panel Migrations from 6.1.1 1`] = `
Object {
{
"orientation": "auto",
"reduceOptions": Object {
"calcs": Array [
"reduceOptions": {
"calcs": [
"last",
],
"limit": undefined,

View File

@ -18,48 +18,48 @@ describe('Worldmap Migrations', () => {
const panel = {} as PanelModel;
panel.options = mapPanelChangedHandler(panel, 'grafana-worldmap-panel', old, prevFieldConfig);
expect(panel).toMatchInlineSnapshot(`
Object {
"fieldConfig": Object {
"defaults": Object {
{
"fieldConfig": {
"defaults": {
"decimals": 3,
"thresholds": Object {
"thresholds": {
"mode": "absolute",
"steps": Array [
Object {
"steps": [
{
"color": "#37872D",
"value": -Infinity,
},
Object {
{
"color": "#E0B400",
"value": 0,
},
Object {
{
"color": "#C4162A",
"value": 50,
},
Object {
{
"color": "#8F3BB8",
"value": 100,
},
],
},
},
"overrides": Array [],
"overrides": [],
},
"options": Object {
"basemap": Object {
"options": {
"basemap": {
"name": "Basemap",
"type": "default",
},
"controls": Object {
"controls": {
"mouseWheelZoom": true,
"showZoom": true,
},
"layers": Array [],
"tooltip": Object {
"layers": [],
"tooltip": {
"mode": "details",
},
"view": Object {
"view": {
"id": "europe",
"lat": 46,
"lon": 14,
@ -142,35 +142,35 @@ describe('geomap migrations', () => {
panel.options = mapMigrationHandler(panel);
expect(panel).toMatchInlineSnapshot(`
Object {
"options": Object {
"layers": Array [
Object {
"config": Object {
{
"options": {
"layers": [
{
"config": {
"showLegend": true,
"style": Object {
"color": Object {
"style": {
"color": {
"field": "Price",
"fixed": "dark-green",
},
"opacity": 0.4,
"rotation": Object {
"rotation": {
"fixed": 0,
"max": 360,
"min": -360,
"mode": "mod",
},
"size": Object {
"size": {
"field": "Count",
"fixed": 5,
"max": 15,
"min": 2,
},
"symbol": Object {
"symbol": {
"fixed": "img/icons/marker/triangle.svg",
"mode": "fixed",
},
"textConfig": Object {
"textConfig": {
"fontSize": 12,
"offsetX": 0,
"offsetY": 0,

View File

@ -34,8 +34,8 @@ describe('style utils', () => {
state.config = null as unknown as StyleConfig; // not interesting in the snapshot
expect(state.hasText).toBe(false);
expect(state).toMatchInlineSnapshot(`
Object {
"base": Object {
{
"base": {
"color": "#37872D",
"lineWidth": 1,
"opacity": 0.4,
@ -43,7 +43,7 @@ describe('style utils', () => {
"size": 5,
},
"config": null,
"fields": Object {
"fields": {
"color": "Price",
"size": "Count",
},

View File

@ -16,7 +16,7 @@ describe('get features utils', () => {
const info = getLayerPropertyInfo(features);
expect(info.geometryType).toBe(GeometryTypeId.Point);
expect(info.propertes.map((v) => v.value)).toMatchInlineSnapshot(`
Array [
[
"a",
"b",
"hello",
@ -29,13 +29,13 @@ describe('get features utils', () => {
const uniqueA = getUniqueFeatureValues(features, 'a');
const uniqueB = getUniqueFeatureValues(features, 'b');
expect(uniqueA).toMatchInlineSnapshot(`
Array [
[
"1",
"2",
]
`);
expect(uniqueB).toMatchInlineSnapshot(`
Array [
[
"10",
"20",
"30",

View File

@ -1,25 +1,25 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Graph DataProcessor getTimeSeries from LegacyResponseData Should return a new series for each field 1`] = `
Array [
[
TimeSeries {
"alias": "Value",
"aliasEscaped": "Value",
"bars": Object {
"bars": {
"fillColor": "#7EB26D",
},
"color": "#7EB26D",
"dataFrameIndex": 0,
"datapoints": Array [
Array [
"datapoints": [
[
1,
1001,
],
Array [
[
2,
1002,
],
Array [
[
3,
1003,
],
@ -29,28 +29,28 @@ Array [
"id": "Value",
"label": "Value",
"legend": true,
"stats": Object {},
"stats": {},
"unit": "watt",
"valueFormater": [Function],
},
TimeSeries {
"alias": "table_data v1",
"aliasEscaped": "table_data v1",
"bars": Object {
"bars": {
"fillColor": "#EAB839",
},
"color": "#EAB839",
"dataFrameIndex": 1,
"datapoints": Array [
Array [
"datapoints": [
[
0.1,
1001,
],
Array [
[
0.2,
1002,
],
Array [
[
0.3,
1003,
],
@ -60,28 +60,28 @@ Array [
"id": "table_data v1",
"label": "table_data v1",
"legend": true,
"stats": Object {},
"stats": {},
"unit": "ohm",
"valueFormater": [Function],
},
TimeSeries {
"alias": "table_data v2",
"aliasEscaped": "table_data v2",
"bars": Object {
"bars": {
"fillColor": "#6ED0E0",
},
"color": "#6ED0E0",
"dataFrameIndex": 1,
"datapoints": Array [
Array [
"datapoints": [
[
1.1,
1001,
],
Array [
[
2.2,
1002,
],
Array [
[
3.3,
1003,
],
@ -91,28 +91,28 @@ Array [
"id": "table_data v2",
"label": "table_data v2",
"legend": true,
"stats": Object {},
"stats": {},
"unit": undefined,
"valueFormater": [Function],
},
TimeSeries {
"alias": "series v1",
"aliasEscaped": "series v1",
"bars": Object {
"bars": {
"fillColor": "#EF843C",
},
"color": "#EF843C",
"dataFrameIndex": 2,
"datapoints": Array [
Array [
"datapoints": [
[
0.1,
1001,
],
Array [
[
0.2,
1002,
],
Array [
[
0.3,
1003,
],
@ -122,28 +122,28 @@ Array [
"id": "series v1",
"label": "series v1",
"legend": true,
"stats": Object {},
"stats": {},
"unit": undefined,
"valueFormater": [Function],
},
TimeSeries {
"alias": "series v2",
"aliasEscaped": "series v2",
"bars": Object {
"bars": {
"fillColor": "#E24D42",
},
"color": "#E24D42",
"dataFrameIndex": 2,
"datapoints": Array [
Array [
"datapoints": [
[
1.1,
1001,
],
Array [
[
2.2,
1002,
],
Array [
[
3.3,
1003,
],
@ -153,28 +153,28 @@ Array [
"id": "series v2",
"label": "series v2",
"legend": true,
"stats": Object {},
"stats": {},
"unit": undefined,
"valueFormater": [Function],
},
TimeSeries {
"alias": "series with time as strings v1",
"aliasEscaped": "series with time as strings v1",
"bars": Object {
"bars": {
"fillColor": "#1F78C1",
},
"color": "#1F78C1",
"dataFrameIndex": 3,
"datapoints": Array [
Array [
"datapoints": [
[
0.1,
1609462800000,
],
Array [
[
0.2,
1609462800000,
],
Array [
[
0.3,
1609466400000,
],
@ -184,7 +184,7 @@ Array [
"id": "series with time as strings v1",
"label": "series with time as strings v1",
"legend": true,
"stats": Object {},
"stats": {},
"unit": undefined,
"valueFormater": [Function],
},
@ -192,85 +192,85 @@ Array [
`;
exports[`Graph DataProcessor getTimeSeries from LegacyResponseData Should return single histogram 1`] = `
Array [
[
TimeSeries {
"alias": "Count",
"aliasEscaped": "Count",
"bars": Object {
"bars": {
"fillColor": "#7EB26D",
},
"color": "#7EB26D",
"dataFrameIndex": 0,
"datapoints": Array [
Array [
"datapoints": [
[
1,
1001,
],
Array [
[
2,
1002,
],
Array [
[
3,
1003,
],
Array [
[
0.1,
1001,
],
Array [
[
0.2,
1002,
],
Array [
[
0.3,
1003,
],
Array [
[
1.1,
1001,
],
Array [
[
2.2,
1002,
],
Array [
[
3.3,
1003,
],
Array [
[
0.1,
1001,
],
Array [
[
0.2,
1002,
],
Array [
[
0.3,
1003,
],
Array [
[
1.1,
1001,
],
Array [
[
2.2,
1002,
],
Array [
[
3.3,
1003,
],
Array [
[
0.1,
1609462800000,
],
Array [
[
0.2,
1609462800000,
],
Array [
[
0.3,
1609466400000,
],
@ -280,7 +280,7 @@ Array [
"id": "Value",
"label": "Value",
"legend": true,
"stats": Object {},
"stats": {},
"unit": "watt",
"valueFormater": [Function],
},

View File

@ -23,21 +23,21 @@ describe('Heatmap Migrations', () => {
prevFieldConfig
);
expect(panel).toMatchInlineSnapshot(`
Object {
"fieldConfig": Object {
"defaults": Object {},
"overrides": Array [],
{
"fieldConfig": {
"defaults": {},
"overrides": [],
},
"options": Object {
"options": {
"calculate": true,
"calculation": Object {
"xBuckets": Object {
"calculation": {
"xBuckets": {
"mode": "count",
"value": "100",
},
"yBuckets": Object {
"yBuckets": {
"mode": "count",
"scale": Object {
"scale": {
"log": 2,
"type": "log",
},
@ -46,10 +46,10 @@ describe('Heatmap Migrations', () => {
},
"cellGap": 2,
"cellRadius": 10,
"cellValues": Object {
"cellValues": {
"decimals": undefined,
},
"color": Object {
"color": {
"exponent": 0.5,
"fill": "#b4ff00",
"max": 100,
@ -60,24 +60,24 @@ describe('Heatmap Migrations', () => {
"scheme": "BuGn",
"steps": 128,
},
"exemplars": Object {
"exemplars": {
"color": "rgba(255,0,255,0.7)",
},
"filterValues": Object {
"filterValues": {
"le": 1e-9,
},
"legend": Object {
"legend": {
"show": true,
},
"rowsFrame": Object {
"rowsFrame": {
"layout": "auto",
},
"showValue": "never",
"tooltip": Object {
"tooltip": {
"show": true,
"yHistogram": true,
},
"yAxis": Object {
"yAxis": {
"axisPlacement": "left",
"axisWidth": 400,
"decimals": 6,

View File

@ -1,54 +1,54 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Timeline Migrations from discrete panel 1`] = `
Object {
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
{
"fieldConfig": {
"defaults": {
"custom": {
"fillOpacity": 100,
"lineWidth": 0,
},
"mappings": Array [
Object {
"options": Object {
"1": Object {
"mappings": [
{
"options": {
"1": {
"color": "#7EB26D",
},
"111": Object {
"111": {
"text": "ONE",
},
"20": Object {
"20": {
"color": "#EAB839",
},
"222": Object {
"222": {
"text": "TWO",
},
"30": Object {
"30": {
"color": "#EF843C",
},
"5": Object {
"5": {
"color": "#E24D42",
},
"90": Object {
"90": {
"color": "#6ED0E0",
},
},
"type": "value",
},
Object {
"options": Object {
{
"options": {
"from": 1,
"result": Object {
"result": {
"text": "AAA",
},
"to": 3,
},
"type": "range",
},
Object {
"options": Object {
{
"options": {
"from": 4,
"result": Object {
"result": {
"text": "BBB",
},
"to": 5,
@ -58,9 +58,9 @@ Object {
],
"unit": "currencyGBP",
},
"overrides": Array [],
"overrides": [],
},
"options": Object {
"options": {
"mergeValues": true,
},
}

View File

@ -59,7 +59,7 @@ describe('prepare timeline graph', () => {
const field = out.fields.find((f) => f.name === 'b');
expect(field?.values.toArray()).toMatchInlineSnapshot(`
Array [
[
1,
1,
undefined,

View File

@ -1,10 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Table Migrations migrates styles to field config overrides and defaults 1`] = `
Object {
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
{
"fieldConfig": {
"defaults": {
"custom": {
"align": "right",
"displayMode": undefined,
},
@ -12,63 +12,63 @@ Object {
"displayName": "",
"unit": "short",
},
"overrides": Array [
Object {
"matcher": Object {
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Time",
},
"properties": Array [
Object {
"properties": [
{
"id": "displayName",
"value": "Time",
},
Object {
{
"id": "unit",
"value": "time: YYYY-MM-DD HH:mm:ss",
},
Object {
{
"id": "custom.align",
"value": null,
},
],
},
Object {
"matcher": Object {
{
"matcher": {
"id": "byName",
"options": "ColorCell",
},
"properties": Array [
Object {
"properties": [
{
"id": "unit",
"value": "currencyUSD",
},
Object {
{
"id": "decimals",
"value": 2,
},
Object {
{
"id": "custom.displayMode",
"value": "color-background",
},
Object {
{
"id": "custom.align",
"value": "left",
},
Object {
{
"id": "thresholds",
"value": Object {
"value": {
"mode": "absolute",
"steps": Array [
Object {
"steps": [
{
"color": "rgba(245, 54, 54, 0.9)",
"value": -Infinity,
},
Object {
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 5,
},
Object {
{
"color": "rgba(50, 172, 45, 0.97)",
"value": 10,
},
@ -77,52 +77,52 @@ Object {
},
],
},
Object {
"matcher": Object {
{
"matcher": {
"id": "byName",
"options": "ColorValue",
},
"properties": Array [
Object {
"properties": [
{
"id": "unit",
"value": "Bps",
},
Object {
{
"id": "decimals",
"value": 2,
},
Object {
{
"id": "links",
"value": Array [
Object {
"value": [
{
"targetBlank": true,
"title": "",
"url": "http://www.grafana.com",
},
],
},
Object {
{
"id": "custom.displayMode",
"value": "color-text",
},
Object {
{
"id": "custom.align",
"value": null,
},
Object {
{
"id": "thresholds",
"value": Object {
"value": {
"mode": "absolute",
"steps": Array [
Object {
"steps": [
{
"color": "rgba(245, 54, 54, 0.9)",
"value": -Infinity,
},
Object {
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 5,
},
Object {
{
"color": "rgba(50, 172, 45, 0.97)",
"value": 10,
},
@ -133,23 +133,23 @@ Object {
},
],
},
"transformations": Array [],
"transformations": [],
}
`;
exports[`Table Migrations migrates transform out to core transforms 1`] = `
Object {
"fieldConfig": Object {
"defaults": Object {
"custom": Object {},
{
"fieldConfig": {
"defaults": {
"custom": {},
},
"overrides": Array [],
"overrides": [],
},
"transformations": Array [
Object {
"transformations": [
{
"id": "seriesToColumns",
"options": Object {
"reducers": Array [],
"options": {
"reducers": [],
},
},
],
@ -157,18 +157,18 @@ Object {
`;
exports[`Table Migrations migrates transform out to core transforms 2`] = `
Object {
"fieldConfig": Object {
"defaults": Object {
"custom": Object {},
{
"fieldConfig": {
"defaults": {
"custom": {},
},
"overrides": Array [],
"overrides": [],
},
"transformations": Array [
Object {
"transformations": [
{
"id": "seriesToRows",
"options": Object {
"reducers": Array [],
"options": {
"reducers": [],
},
},
],
@ -176,19 +176,19 @@ Object {
`;
exports[`Table Migrations migrates transform out to core transforms 3`] = `
Object {
"fieldConfig": Object {
"defaults": Object {
"custom": Object {},
{
"fieldConfig": {
"defaults": {
"custom": {},
},
"overrides": Array [],
"overrides": [],
},
"transformations": Array [
Object {
"transformations": [
{
"id": "reduce",
"options": Object {
"options": {
"includeTimeField": false,
"reducers": Array [
"reducers": [
"mean",
"max",
"lastNotNull",
@ -200,18 +200,18 @@ Object {
`;
exports[`Table Migrations migrates transform out to core transforms 4`] = `
Object {
"fieldConfig": Object {
"defaults": Object {
"custom": Object {},
{
"fieldConfig": {
"defaults": {
"custom": {},
},
"overrides": Array [],
"overrides": [],
},
"transformations": Array [
Object {
"transformations": [
{
"id": "merge",
"options": Object {
"reducers": Array [],
"options": {
"reducers": [],
},
},
],

View File

@ -1,11 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Graph Migrations legend with multiple values 1`] = `
Object {
{
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
"fieldConfig": {
"defaults": {
"custom": {
"axisPlacement": "auto",
"drawStyle": "line",
"fillOpacity": 50,
@ -17,16 +17,16 @@ Object {
"nullValueMode": "null",
"unit": "short",
},
"overrides": Array [
Object {
"matcher": Object {
"overrides": [
{
"matcher": {
"id": "byName",
"options": "A-series",
},
"properties": Array [
Object {
"properties": [
{
"id": "color",
"value": Object {
"value": {
"fixedColor": "red",
"mode": "fixed",
},
@ -35,9 +35,9 @@ Object {
},
],
},
"options": Object {
"legend": Object {
"calcs": Array [
"options": {
"legend": {
"calcs": [
"mean",
"lastNotNull",
"sum",
@ -46,7 +46,7 @@ Object {
"placement": "bottom",
"showLegend": true,
},
"tooltip": Object {
"tooltip": {
"mode": "multi",
"sort": "none",
},
@ -55,27 +55,27 @@ Object {
`;
exports[`Graph Migrations legend with single value 1`] = `
Object {
{
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "points",
"spanNulls": false,
},
},
"overrides": Array [],
"overrides": [],
},
"options": Object {
"legend": Object {
"calcs": Array [
"options": {
"legend": {
"calcs": [
"sum",
],
"displayMode": "list",
"placement": "bottom",
"showLegend": true,
},
"tooltip": Object {
"tooltip": {
"mode": "single",
"sort": "none",
},
@ -84,25 +84,25 @@ Object {
`;
exports[`Graph Migrations legend without values 1`] = `
Object {
{
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "points",
"spanNulls": false,
},
},
"overrides": Array [],
"overrides": [],
},
"options": Object {
"legend": Object {
"calcs": Array [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true,
},
"tooltip": Object {
"tooltip": {
"mode": "single",
"sort": "none",
},
@ -111,11 +111,11 @@ Object {
`;
exports[`Graph Migrations preserves colors from series overrides 1`] = `
Object {
{
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
"fieldConfig": {
"defaults": {
"custom": {
"axisPlacement": "hidden",
"drawStyle": "line",
"fillOpacity": 60,
@ -128,31 +128,31 @@ Object {
"nullValueMode": "null",
"unit": "short",
},
"overrides": Array [
Object {
"matcher": Object {
"overrides": [
{
"matcher": {
"id": "byName",
"options": "A-series",
},
"properties": Array [
Object {
"properties": [
{
"id": "color",
"value": Object {
"value": {
"fixedColor": "rgba(165, 72, 170, 0.77)",
"mode": "fixed",
},
},
],
},
Object {
"matcher": Object {
{
"matcher": {
"id": "byName",
"options": "B-series",
},
"properties": Array [
Object {
"properties": [
{
"id": "color",
"value": Object {
"value": {
"fixedColor": "rgba(16, 72, 170, 0.77)",
"mode": "fixed",
},
@ -161,9 +161,9 @@ Object {
},
],
},
"options": Object {
"legend": Object {
"calcs": Array [
"options": {
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max",
@ -174,7 +174,7 @@ Object {
"placement": "bottom",
"showLegend": true,
},
"tooltip": Object {
"tooltip": {
"mode": "multi",
"sort": "none",
},
@ -183,11 +183,11 @@ Object {
`;
exports[`Graph Migrations preserves series overrides using a regex alias 1`] = `
Object {
{
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
"fieldConfig": {
"defaults": {
"custom": {
"axisPlacement": "hidden",
"drawStyle": "line",
"fillOpacity": 60,
@ -200,31 +200,31 @@ Object {
"nullValueMode": "null",
"unit": "short",
},
"overrides": Array [
Object {
"matcher": Object {
"overrides": [
{
"matcher": {
"id": "byRegexp",
"options": "/^A-/",
},
"properties": Array [
Object {
"properties": [
{
"id": "color",
"value": Object {
"value": {
"fixedColor": "rgba(165, 72, 170, 0.77)",
"mode": "fixed",
},
},
],
},
Object {
"matcher": Object {
{
"matcher": {
"id": "byRegexp",
"options": "/.*Status: 2[0-9]+.*/i",
},
"properties": Array [
Object {
"properties": [
{
"id": "color",
"value": Object {
"value": {
"fixedColor": "rgba(16, 72, 170, 0.77)",
"mode": "fixed",
},
@ -233,9 +233,9 @@ Object {
},
],
},
"options": Object {
"legend": Object {
"calcs": Array [
"options": {
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max",
@ -246,7 +246,7 @@ Object {
"placement": "bottom",
"showLegend": true,
},
"tooltip": Object {
"tooltip": {
"mode": "multi",
"sort": "none",
},
@ -255,27 +255,27 @@ Object {
`;
exports[`Graph Migrations simple bars 1`] = `
Object {
{
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "bars",
"fillOpacity": 100,
"showPoints": "never",
"spanNulls": false,
},
},
"overrides": Array [],
"overrides": [],
},
"options": Object {
"legend": Object {
"calcs": Array [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true,
},
"tooltip": Object {
"tooltip": {
"mode": "single",
"sort": "none",
},
@ -284,11 +284,11 @@ Object {
`;
exports[`Graph Migrations stacking groups 1`] = `
Object {
{
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
"fieldConfig": {
"defaults": {
"custom": {
"axisPlacement": "auto",
"drawStyle": "line",
"fillOpacity": 50,
@ -296,7 +296,7 @@ Object {
"lineWidth": 5,
"showPoints": "never",
"spanNulls": false,
"stacking": Object {
"stacking": {
"group": "A",
"mode": "normal",
},
@ -304,46 +304,46 @@ Object {
"nullValueMode": "null",
"unit": "short",
},
"overrides": Array [
Object {
"matcher": Object {
"overrides": [
{
"matcher": {
"id": "byName",
"options": "A-series",
},
"properties": Array [
Object {
"properties": [
{
"id": "color",
"value": Object {
"value": {
"fixedColor": "red",
"mode": "fixed",
},
},
],
},
Object {
"matcher": Object {
{
"matcher": {
"id": "byName",
"options": "A-series",
},
"properties": Array [
Object {
"properties": [
{
"id": "custom.stacking",
"value": Object {
"value": {
"group": "A",
"mode": "normal",
},
},
],
},
Object {
"matcher": Object {
{
"matcher": {
"id": "byName",
"options": "B-series",
},
"properties": Array [
Object {
"properties": [
{
"id": "custom.stacking",
"value": Object {
"value": {
"group": "A",
"mode": "normal",
},
@ -352,9 +352,9 @@ Object {
},
],
},
"options": Object {
"legend": Object {
"calcs": Array [
"options": {
"legend": {
"calcs": [
"mean",
"lastNotNull",
"sum",
@ -363,7 +363,7 @@ Object {
"placement": "bottom",
"showLegend": true,
},
"tooltip": Object {
"tooltip": {
"mode": "multi",
"sort": "none",
},
@ -372,11 +372,11 @@ Object {
`;
exports[`Graph Migrations stacking simple 1`] = `
Object {
{
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
"fieldConfig": {
"defaults": {
"custom": {
"axisPlacement": "auto",
"drawStyle": "line",
"fillOpacity": 50,
@ -384,7 +384,7 @@ Object {
"lineWidth": 5,
"showPoints": "never",
"spanNulls": false,
"stacking": Object {
"stacking": {
"group": "A",
"mode": "normal",
},
@ -392,16 +392,16 @@ Object {
"nullValueMode": "null",
"unit": "short",
},
"overrides": Array [
Object {
"matcher": Object {
"overrides": [
{
"matcher": {
"id": "byName",
"options": "A-series",
},
"properties": Array [
Object {
"properties": [
{
"id": "color",
"value": Object {
"value": {
"fixedColor": "red",
"mode": "fixed",
},
@ -410,9 +410,9 @@ Object {
},
],
},
"options": Object {
"legend": Object {
"calcs": Array [
"options": {
"legend": {
"calcs": [
"mean",
"lastNotNull",
"sum",
@ -421,7 +421,7 @@ Object {
"placement": "bottom",
"showLegend": true,
},
"tooltip": Object {
"tooltip": {
"mode": "multi",
"sort": "none",
},
@ -430,11 +430,11 @@ Object {
`;
exports[`Graph Migrations stairscase 1`] = `
Object {
{
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
"fieldConfig": {
"defaults": {
"custom": {
"axisPlacement": "hidden",
"drawStyle": "line",
"fillOpacity": 60,
@ -448,11 +448,11 @@ Object {
"nullValueMode": "null",
"unit": "short",
},
"overrides": Array [],
"overrides": [],
},
"options": Object {
"legend": Object {
"calcs": Array [
"options": {
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max",
@ -463,7 +463,7 @@ Object {
"placement": "bottom",
"showLegend": true,
},
"tooltip": Object {
"tooltip": {
"mode": "multi",
"sort": "none",
},
@ -472,11 +472,11 @@ Object {
`;
exports[`Graph Migrations stepped line 1`] = `
Object {
{
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
"fieldConfig": {
"defaults": {
"custom": {
"axisPlacement": "auto",
"drawStyle": "line",
"fillOpacity": 50,
@ -488,16 +488,16 @@ Object {
"nullValueMode": "null",
"unit": "short",
},
"overrides": Array [
Object {
"matcher": Object {
"overrides": [
{
"matcher": {
"id": "byName",
"options": "A-series",
},
"properties": Array [
Object {
"properties": [
{
"id": "color",
"value": Object {
"value": {
"fixedColor": "red",
"mode": "fixed",
},
@ -506,14 +506,14 @@ Object {
},
],
},
"options": Object {
"legend": Object {
"calcs": Array [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true,
},
"tooltip": Object {
"tooltip": {
"mode": "multi",
"sort": "none",
},
@ -522,21 +522,21 @@ Object {
`;
exports[`Graph Migrations transforms should preserve "constant" transform 1`] = `
Object {
"defaults": Object {
"custom": Object {
{
"defaults": {
"custom": {
"drawStyle": "points",
"spanNulls": false,
},
},
"overrides": Array [
Object {
"matcher": Object {
"overrides": [
{
"matcher": {
"id": "byName",
"options": "out",
},
"properties": Array [
Object {
"properties": [
{
"id": "custom.transform",
"value": "constant",
},
@ -547,21 +547,21 @@ Object {
`;
exports[`Graph Migrations transforms should preserve "negative-Y" transform 1`] = `
Object {
"defaults": Object {
"custom": Object {
{
"defaults": {
"custom": {
"drawStyle": "points",
"spanNulls": false,
},
},
"overrides": Array [
Object {
"matcher": Object {
"overrides": [
{
"matcher": {
"id": "byName",
"options": "out",
},
"properties": Array [
Object {
"properties": [
{
"id": "custom.transform",
"value": "negative-Y",
},
@ -572,24 +572,24 @@ Object {
`;
exports[`Graph Migrations twoYAxis 1`] = `
Object {
{
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
"fieldConfig": {
"defaults": {
"custom": {
"axisLabel": "Y111",
"axisPlacement": "auto",
"drawStyle": "line",
"fillOpacity": 10,
"lineStyle": Object {
"dash": Array [
"lineStyle": {
"dash": [
10,
10,
],
"fill": "dash",
},
"lineWidth": 1,
"scaleDistribution": Object {
"scaleDistribution": {
"log": 10,
"type": "log",
},
@ -602,37 +602,37 @@ Object {
"nullValueMode": "null",
"unit": "areaMI2",
},
"overrides": Array [
Object {
"matcher": Object {
"overrides": [
{
"matcher": {
"id": "byName",
"options": "B-series",
},
"properties": Array [
Object {
"properties": [
{
"id": "unit",
"value": "degree",
},
Object {
{
"id": "decimals",
"value": 2,
},
Object {
{
"id": "min",
"value": -10,
},
Object {
{
"id": "max",
"value": 25,
},
Object {
{
"id": "custom.axisLabel",
"value": "Y222",
},
Object {
{
"id": "custom.lineStyle",
"value": Object {
"dash": Array [
"value": {
"dash": [
5,
8,
],
@ -643,14 +643,14 @@ Object {
},
],
},
"options": Object {
"legend": Object {
"calcs": Array [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true,
},
"tooltip": Object {
"tooltip": {
"mode": "multi",
"sort": "none",
},
@ -659,21 +659,21 @@ Object {
`;
exports[`Graph Migrations x axis should hide x axis 1`] = `
Object {
"defaults": Object {
"custom": Object {
{
"defaults": {
"custom": {
"drawStyle": "points",
"spanNulls": false,
},
},
"overrides": Array [
Object {
"matcher": Object {
"overrides": [
{
"matcher": {
"id": "byType",
"options": "time",
},
"properties": Array [
Object {
"properties": [
{
"id": "custom.axisPlacement",
"value": "hidden",
},

View File

@ -193,16 +193,16 @@ describe('Graph Migrations', () => {
panel.options = graphPanelChangedHandler(panel, 'graph', old, prevFieldConfig);
expect(panel.fieldConfig.defaults.custom.thresholdsStyle.mode).toBe('area');
expect(panel.fieldConfig.defaults.thresholds?.steps).toMatchInlineSnapshot(`
Array [
Object {
[
{
"color": "transparent",
"value": -Infinity,
},
Object {
{
"color": "orange",
"value": 50,
},
Object {
{
"color": "red",
"value": 80,
},
@ -238,16 +238,16 @@ describe('Graph Migrations', () => {
panel.options = graphPanelChangedHandler(panel, 'graph', old, prevFieldConfig);
expect(panel.fieldConfig.defaults.custom.thresholdsStyle.mode).toBe('line+area');
expect(panel.fieldConfig.defaults.thresholds?.steps).toMatchInlineSnapshot(`
Array [
Object {
[
{
"color": "orange",
"value": -Infinity,
},
Object {
{
"color": "transparent",
"value": 40,
},
Object {
{
"color": "red",
"value": 80,
},
@ -275,12 +275,12 @@ describe('Graph Migrations', () => {
panel.options = graphPanelChangedHandler(panel, 'graph', old, prevFieldConfig);
expect(panel.fieldConfig.defaults.custom.thresholdsStyle.mode).toBe('line+area');
expect(panel.fieldConfig.defaults.thresholds?.steps).toMatchInlineSnapshot(`
Array [
Object {
[
{
"color": "orange",
"value": -Infinity,
},
Object {
{
"color": "transparent",
"value": 40,
},

View File

@ -48,7 +48,7 @@ describe('prepare timeseries graph', () => {
const field = out.fields.find((f) => f.name === 'c');
expect(field?.display).toBeDefined();
expect(field!.display!(1)).toMatchInlineSnapshot(`
Object {
{
"color": "#808080",
"numeric": 1,
"percent": 1,
@ -70,7 +70,7 @@ describe('prepare timeseries graph', () => {
const field = frames![0].fields.find((f) => f.name === 'a');
expect(field!.values.toArray()).toMatchInlineSnapshot(`
Array [
[
-10,
null,
10,
@ -91,7 +91,7 @@ describe('prepare timeseries graph', () => {
const field = frames![0].fields.find((f) => f.name === 'a');
expect(field!.values.toArray()).toMatchInlineSnapshot(`
Array [
[
1,
null,
2,
@ -115,7 +115,7 @@ describe('prepare timeseries graph', () => {
const field = frames![0].fields.find((f) => f.name === 'a');
expect(field!.values.toArray()).toMatchInlineSnapshot(`
Array [
[
1,
20,
2,

1058
yarn.lock

File diff suppressed because it is too large Load Diff