@perses-dev/plugin-system 0.0.0-snapshot-embed-import-errors-8906900 → 0.0.0-snapshot-test-internal-dep-dd238ac
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/CalculationSelector/CalculationSelector.js +1 -1
- package/dist/cjs/components/CalculationSelector/index.js +1 -1
- package/dist/cjs/components/DatasourceSelect.js +1 -1
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +5 -48
- package/dist/cjs/components/OptionsEditorTabs/TabPanel.js +1 -1
- package/dist/cjs/components/OptionsEditorTabs/index.js +1 -1
- package/dist/cjs/components/PluginEditor/PluginEditor.js +1 -1
- package/dist/cjs/components/PluginEditor/index.js +1 -1
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +1 -1
- package/dist/cjs/components/PluginKindSelect.js +1 -1
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +1 -1
- package/dist/cjs/components/PluginRegistry/index.js +1 -1
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +1 -1
- package/dist/cjs/components/PluginSpecEditor.js +39 -5
- package/dist/cjs/components/TimeSeriesQueryEditor.js +1 -1
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/model/calculations.js +11 -13
- package/dist/cjs/model/datasource.js +1 -1
- package/dist/cjs/model/index.js +3 -3
- package/dist/cjs/model/panels.js +7 -1
- package/dist/cjs/model/plugin-base.js +1 -1
- package/dist/cjs/model/plugin-loading.js +1 -1
- package/dist/cjs/model/plugins.js +1 -1
- package/dist/cjs/model/time-series-queries.js +1 -1
- package/dist/cjs/model/variables.js +1 -1
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
- package/dist/cjs/runtime/TimeRangeProvider/index.js +1 -1
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +1 -1
- package/dist/cjs/runtime/datasources.js +1 -1
- package/dist/cjs/runtime/index.js +1 -1
- package/dist/cjs/runtime/plugin-registry.js +1 -1
- package/dist/cjs/runtime/template-variables.js +1 -1
- package/dist/cjs/runtime/time-series-queries.js +1 -1
- package/dist/cjs/test/index.js +1 -1
- package/dist/cjs/test/render.js +1 -1
- package/dist/cjs/test/setup-tests.js +1 -1
- package/dist/cjs/test/test-plugins/bert/index.js +33 -20
- package/dist/cjs/test/test-plugins/ernie/index.js +1 -1
- package/dist/cjs/test/test-plugins/index.js +1 -1
- package/dist/cjs/test-utils/index.js +1 -1
- package/dist/cjs/test-utils/mock-plugin-registry.js +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
- package/dist/components/CalculationSelector/index.js +1 -1
- package/dist/components/CalculationSelector/index.js.map +1 -1
- package/dist/components/DatasourceSelect.js +1 -1
- package/dist/components/DatasourceSelect.js.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +3 -24
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +5 -48
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
- package/dist/components/OptionsEditorTabs/TabPanel.js +1 -1
- package/dist/components/OptionsEditorTabs/TabPanel.js.map +1 -1
- package/dist/components/OptionsEditorTabs/index.js +1 -1
- package/dist/components/OptionsEditorTabs/index.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +1 -1
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/index.js +1 -1
- package/dist/components/PluginEditor/index.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect.js +1 -1
- package/dist/components/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/index.js +1 -1
- package/dist/components/PluginRegistry/index.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor.d.ts.map +1 -1
- package/dist/components/PluginSpecEditor.js +40 -6
- package/dist/components/PluginSpecEditor.js.map +1 -1
- package/dist/components/TimeSeriesQueryEditor.js +1 -1
- package/dist/components/TimeSeriesQueryEditor.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model/calculations.d.ts +1 -1
- package/dist/model/calculations.d.ts.map +1 -1
- package/dist/model/calculations.js +9 -5
- package/dist/model/calculations.js.map +1 -1
- package/dist/model/datasource.js +1 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/index.d.ts +2 -2
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +3 -3
- package/dist/model/index.js.map +1 -1
- package/dist/model/panels.d.ts +14 -2
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js +2 -2
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugin-base.d.ts +1 -1
- package/dist/model/plugin-base.d.ts.map +1 -1
- package/dist/model/plugin-base.js +1 -1
- package/dist/model/plugin-base.js.map +1 -1
- package/dist/model/plugin-loading.js +1 -1
- package/dist/model/plugin-loading.js.map +1 -1
- package/dist/model/plugins.js +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/model/time-series-queries.d.ts +3 -4
- package/dist/model/time-series-queries.d.ts.map +1 -1
- package/dist/model/time-series-queries.js +1 -1
- package/dist/model/time-series-queries.js.map +1 -1
- package/dist/model/variables.js +1 -1
- package/dist/model/variables.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/index.js +1 -1
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/datasources.js +1 -1
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/plugin-registry.js +1 -1
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/template-variables.js +1 -1
- package/dist/runtime/template-variables.js.map +1 -1
- package/dist/runtime/time-series-queries.js +1 -1
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/test/index.js +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
- package/dist/test/test-plugins/bert/index.js +33 -20
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/test/test-plugins/ernie/index.js +1 -1
- package/dist/test/test-plugins/ernie/index.js.map +1 -1
- package/dist/test/test-plugins/index.js +1 -1
- package/dist/test/test-plugins/index.js.map +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +1 -1
- package/dist/test-utils/mock-plugin-registry.js.map +1 -1
- package/package.json +5 -4
- package/dist/cjs/components/CalculationSelector/CalculationSelector.test.js +0 -65
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.test.js +0 -167
- package/dist/cjs/components/PluginEditor/PluginEditor.test.js +0 -150
- package/dist/cjs/components/PluginKindSelect.test.js +0 -86
- package/dist/cjs/components/PluginRegistry/PluginRegistry.test.js +0 -144
- package/dist/cjs/components/PluginSpecEditor.test.js +0 -70
- package/dist/components/CalculationSelector/CalculationSelector.test.d.ts +0 -2
- package/dist/components/CalculationSelector/CalculationSelector.test.d.ts.map +0 -1
- package/dist/components/CalculationSelector/CalculationSelector.test.js +0 -58
- package/dist/components/CalculationSelector/CalculationSelector.test.js.map +0 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.d.ts +0 -2
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.d.ts.map +0 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.js +0 -160
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.js.map +0 -1
- package/dist/components/PluginEditor/PluginEditor.test.d.ts +0 -2
- package/dist/components/PluginEditor/PluginEditor.test.d.ts.map +0 -1
- package/dist/components/PluginEditor/PluginEditor.test.js +0 -143
- package/dist/components/PluginEditor/PluginEditor.test.js.map +0 -1
- package/dist/components/PluginKindSelect.test.d.ts +0 -2
- package/dist/components/PluginKindSelect.test.d.ts.map +0 -1
- package/dist/components/PluginKindSelect.test.js +0 -79
- package/dist/components/PluginKindSelect.test.js.map +0 -1
- package/dist/components/PluginRegistry/PluginRegistry.test.d.ts +0 -2
- package/dist/components/PluginRegistry/PluginRegistry.test.d.ts.map +0 -1
- package/dist/components/PluginRegistry/PluginRegistry.test.js +0 -137
- package/dist/components/PluginRegistry/PluginRegistry.test.js.map +0 -1
- package/dist/components/PluginSpecEditor.test.d.ts +0 -2
- package/dist/components/PluginSpecEditor.test.d.ts.map +0 -1
- package/dist/components/PluginSpecEditor.test.js +0 -63
- package/dist/components/PluginSpecEditor.test.js.map +0 -1
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
// Copyright 2022 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import React from 'react';
|
|
15
|
-
import { screen } from '@testing-library/react';
|
|
16
|
-
import { useListPluginMetadata, usePlugin } from '../../runtime';
|
|
17
|
-
import { renderWithContext } from '../../test';
|
|
18
|
-
describe('PluginRegistry', ()=>{
|
|
19
|
-
const renderPluginRegistry = (children)=>{
|
|
20
|
-
renderWithContext(children);
|
|
21
|
-
};
|
|
22
|
-
it('can load a plugin that exists', async ()=>{
|
|
23
|
-
renderPluginRegistry(/*#__PURE__*/ _jsx(PluginConsumer, {
|
|
24
|
-
pluginType: "Variable",
|
|
25
|
-
kind: "ErnieVariable"
|
|
26
|
-
}));
|
|
27
|
-
const hasPlugin = await screen.findByText('Has plugin: true', undefined, {
|
|
28
|
-
timeout: 3000
|
|
29
|
-
});
|
|
30
|
-
expect(hasPlugin).toBeInTheDocument();
|
|
31
|
-
});
|
|
32
|
-
it('errors when plugin is not installed', async ()=>{
|
|
33
|
-
// This plugin is not in the test metadata at all
|
|
34
|
-
renderPluginRegistry(/*#__PURE__*/ _jsx(PluginConsumer, {
|
|
35
|
-
pluginType: "TimeSeriesQuery",
|
|
36
|
-
kind: "NotInstalled"
|
|
37
|
-
}));
|
|
38
|
-
const error = await screen.findByText(/error:/i);
|
|
39
|
-
expect(error).toBeInTheDocument();
|
|
40
|
-
expect(error).toHaveTextContent(/not installed/i);
|
|
41
|
-
});
|
|
42
|
-
it('errors when plugin is missing from the module', async ()=>{
|
|
43
|
-
// This plugin is in the test metadata, but the code is missing from the module
|
|
44
|
-
renderPluginRegistry(/*#__PURE__*/ _jsx(PluginConsumer, {
|
|
45
|
-
pluginType: "Variable",
|
|
46
|
-
kind: "MissingErnieVariable"
|
|
47
|
-
}));
|
|
48
|
-
const error = await screen.findByText(/error:/i);
|
|
49
|
-
expect(error).toBeInTheDocument();
|
|
50
|
-
expect(error).toHaveTextContent(/missing/i);
|
|
51
|
-
});
|
|
52
|
-
it('lists metadata for plugin metadata that exists', async ()=>{
|
|
53
|
-
// There should be 3 variable plugins across both test modules
|
|
54
|
-
renderPluginRegistry(/*#__PURE__*/ _jsx(MetadataConsumer, {
|
|
55
|
-
pluginType: "Variable"
|
|
56
|
-
}));
|
|
57
|
-
const table = await screen.findByRole('table');
|
|
58
|
-
expect(table).toBeInTheDocument();
|
|
59
|
-
const rows = screen.getAllByRole('row');
|
|
60
|
-
expect(rows).toHaveLength(3);
|
|
61
|
-
});
|
|
62
|
-
it('lists metadata for plugin types with no plugins available', async ()=>{
|
|
63
|
-
// There are no TimeSeriesQuery plugins in any of the test modules
|
|
64
|
-
renderPluginRegistry(/*#__PURE__*/ _jsx(MetadataConsumer, {
|
|
65
|
-
pluginType: "TimeSeriesQuery"
|
|
66
|
-
}));
|
|
67
|
-
const table = await screen.findByRole('table');
|
|
68
|
-
expect(table).toBeInTheDocument();
|
|
69
|
-
const rows = screen.queryAllByRole('row');
|
|
70
|
-
expect(rows).toHaveLength(0);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
// A helper component for testing the PluginRegistry by calling usePlugin to load a plugin
|
|
74
|
-
const PluginConsumer = (props)=>{
|
|
75
|
-
const { data: plugin , isLoading , error } = usePlugin(props.pluginType, props.kind);
|
|
76
|
-
if (error) {
|
|
77
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
78
|
-
children: [
|
|
79
|
-
"Error: ",
|
|
80
|
-
error.message
|
|
81
|
-
]
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
if (isLoading) {
|
|
85
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
86
|
-
children: "Loading"
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
90
|
-
children: [
|
|
91
|
-
"Has plugin: ",
|
|
92
|
-
(plugin !== undefined).toString()
|
|
93
|
-
]
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
// A helper component for testing the PluginRegistry metadata APIs by calling useListPluginMetadata
|
|
97
|
-
const MetadataConsumer = (props)=>{
|
|
98
|
-
const { data: pluginMetadata , isLoading , error } = useListPluginMetadata(props.pluginType);
|
|
99
|
-
if (error) {
|
|
100
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
101
|
-
children: [
|
|
102
|
-
"Error: ",
|
|
103
|
-
error.message
|
|
104
|
-
]
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
if (isLoading) {
|
|
108
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
109
|
-
children: "Loading"
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
if (pluginMetadata === undefined) {
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
return /*#__PURE__*/ _jsx("table", {
|
|
116
|
-
children: /*#__PURE__*/ _jsx("tbody", {
|
|
117
|
-
children: pluginMetadata.map((item)=>/*#__PURE__*/ _jsxs("tr", {
|
|
118
|
-
children: [
|
|
119
|
-
/*#__PURE__*/ _jsx("td", {
|
|
120
|
-
children: item.pluginType
|
|
121
|
-
}),
|
|
122
|
-
/*#__PURE__*/ _jsx("td", {
|
|
123
|
-
children: item.kind
|
|
124
|
-
}),
|
|
125
|
-
/*#__PURE__*/ _jsx("td", {
|
|
126
|
-
children: item.display.name
|
|
127
|
-
}),
|
|
128
|
-
/*#__PURE__*/ _jsx("td", {
|
|
129
|
-
children: item.display.description
|
|
130
|
-
})
|
|
131
|
-
]
|
|
132
|
-
}, item.kind))
|
|
133
|
-
})
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
//# sourceMappingURL=PluginRegistry.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PluginRegistry/PluginRegistry.test.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React from 'react';\nimport { screen } from '@testing-library/react';\nimport { PluginType } from '../../model';\nimport { useListPluginMetadata, usePlugin } from '../../runtime';\nimport { renderWithContext } from '../../test';\n\ndescribe('PluginRegistry', () => {\n const renderPluginRegistry = (children: React.ReactNode) => {\n renderWithContext(children);\n };\n\n it('can load a plugin that exists', async () => {\n renderPluginRegistry(<PluginConsumer pluginType=\"Variable\" kind=\"ErnieVariable\" />);\n\n const hasPlugin = await screen.findByText('Has plugin: true', undefined, { timeout: 3000 });\n expect(hasPlugin).toBeInTheDocument();\n });\n\n it('errors when plugin is not installed', async () => {\n // This plugin is not in the test metadata at all\n renderPluginRegistry(<PluginConsumer pluginType=\"TimeSeriesQuery\" kind=\"NotInstalled\" />);\n\n const error = await screen.findByText(/error:/i);\n expect(error).toBeInTheDocument();\n expect(error).toHaveTextContent(/not installed/i);\n });\n\n it('errors when plugin is missing from the module', async () => {\n // This plugin is in the test metadata, but the code is missing from the module\n renderPluginRegistry(<PluginConsumer pluginType=\"Variable\" kind=\"MissingErnieVariable\" />);\n\n const error = await screen.findByText(/error:/i);\n expect(error).toBeInTheDocument();\n expect(error).toHaveTextContent(/missing/i);\n });\n\n it('lists metadata for plugin metadata that exists', async () => {\n // There should be 3 variable plugins across both test modules\n renderPluginRegistry(<MetadataConsumer pluginType=\"Variable\" />);\n\n const table = await screen.findByRole('table');\n expect(table).toBeInTheDocument();\n const rows = screen.getAllByRole('row');\n expect(rows).toHaveLength(3);\n });\n\n it('lists metadata for plugin types with no plugins available', async () => {\n // There are no TimeSeriesQuery plugins in any of the test modules\n renderPluginRegistry(<MetadataConsumer pluginType=\"TimeSeriesQuery\" />);\n\n const table = await screen.findByRole('table');\n expect(table).toBeInTheDocument();\n const rows = screen.queryAllByRole('row');\n expect(rows).toHaveLength(0);\n });\n});\n\n// A helper component for testing the PluginRegistry by calling usePlugin to load a plugin\nconst PluginConsumer = (props: { pluginType: PluginType; kind: string }) => {\n const { data: plugin, isLoading, error } = usePlugin(props.pluginType, props.kind);\n if (error) {\n return <div>Error: {(error as Error).message}</div>;\n }\n if (isLoading) {\n return <div>Loading</div>;\n }\n return <div>Has plugin: {(plugin !== undefined).toString()}</div>;\n};\n\n// A helper component for testing the PluginRegistry metadata APIs by calling useListPluginMetadata\nconst MetadataConsumer = (props: { pluginType: PluginType }) => {\n const { data: pluginMetadata, isLoading, error } = useListPluginMetadata(props.pluginType);\n if (error) {\n return <div>Error: {(error as Error).message}</div>;\n }\n if (isLoading) {\n return <div>Loading</div>;\n }\n\n if (pluginMetadata === undefined) {\n return null;\n }\n\n return (\n <table>\n <tbody>\n {pluginMetadata.map((item) => (\n <tr key={item.kind}>\n <td>{item.pluginType}</td>\n <td>{item.kind}</td>\n <td>{item.display.name}</td>\n <td>{item.display.description}</td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n"],"names":["React","screen","useListPluginMetadata","usePlugin","renderWithContext","describe","renderPluginRegistry","children","it","PluginConsumer","pluginType","kind","hasPlugin","findByText","undefined","timeout","expect","toBeInTheDocument","error","toHaveTextContent","MetadataConsumer","table","findByRole","rows","getAllByRole","toHaveLength","queryAllByRole","props","data","plugin","isLoading","div","message","toString","pluginMetadata","tbody","map","item","tr","td","display","name","description"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,OAAOA,KAAK,MAAM,O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AAM;;mBAJ5BL,IAAI,CAAC1B,IAAI,CAKb,AACN,CAAC;UACI;MACF,CACR;AACJ,CAAC,AAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PluginSpecEditor.test.d.ts","sourceRoot":"","sources":["../../src/components/PluginSpecEditor.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// Copyright 2022 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import userEvent from '@testing-library/user-event';
|
|
15
|
-
import { screen } from '@testing-library/react';
|
|
16
|
-
import { renderWithContext } from '../test';
|
|
17
|
-
import { PluginSpecEditor } from './PluginSpecEditor';
|
|
18
|
-
describe('PluginSpecEditor', ()=>{
|
|
19
|
-
const renderComponent = (props)=>{
|
|
20
|
-
renderWithContext(/*#__PURE__*/ _jsx(PluginSpecEditor, {
|
|
21
|
-
...props
|
|
22
|
-
}));
|
|
23
|
-
};
|
|
24
|
-
it('shows the options editor component for a plugin', async ()=>{
|
|
25
|
-
renderComponent({
|
|
26
|
-
pluginType: 'Panel',
|
|
27
|
-
pluginKind: 'BertPanel1',
|
|
28
|
-
value: {},
|
|
29
|
-
onChange: jest.fn()
|
|
30
|
-
});
|
|
31
|
-
const editor = await screen.findByLabelText('BertPanel1 editor');
|
|
32
|
-
expect(editor).toBeInTheDocument();
|
|
33
|
-
});
|
|
34
|
-
it('propagates value changes', async ()=>{
|
|
35
|
-
const onChange = jest.fn();
|
|
36
|
-
renderComponent({
|
|
37
|
-
pluginType: 'Panel',
|
|
38
|
-
pluginKind: 'BertPanel1',
|
|
39
|
-
value: {
|
|
40
|
-
option1: 'Option1Value'
|
|
41
|
-
},
|
|
42
|
-
onChange
|
|
43
|
-
});
|
|
44
|
-
const editor = await screen.findByLabelText('BertPanel1 editor');
|
|
45
|
-
expect(editor).toHaveValue('Option1Value');
|
|
46
|
-
userEvent.clear(editor);
|
|
47
|
-
expect(onChange).toHaveBeenCalledWith({
|
|
48
|
-
option1: ''
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
it('shows an error if plugin fails to load', async ()=>{
|
|
52
|
-
renderComponent({
|
|
53
|
-
pluginType: 'Variable',
|
|
54
|
-
pluginKind: 'DoesNotExist',
|
|
55
|
-
value: {},
|
|
56
|
-
onChange: jest.fn()
|
|
57
|
-
});
|
|
58
|
-
const errorAlert = await screen.findByRole('alert');
|
|
59
|
-
expect(errorAlert).toHaveTextContent(/doesnotexist/i);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
//# sourceMappingURL=PluginSpecEditor.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/PluginSpecEditor.test.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport userEvent from '@testing-library/user-event';\nimport { screen } from '@testing-library/react';\nimport { renderWithContext } from '../test';\nimport { PluginSpecEditor, PluginSpecEditorProps } from './PluginSpecEditor';\n\ndescribe('PluginSpecEditor', () => {\n const renderComponent = (props: PluginSpecEditorProps) => {\n renderWithContext(<PluginSpecEditor {...props} />);\n };\n\n it('shows the options editor component for a plugin', async () => {\n renderComponent({ pluginType: 'Panel', pluginKind: 'BertPanel1', value: {}, onChange: jest.fn() });\n const editor = await screen.findByLabelText('BertPanel1 editor');\n expect(editor).toBeInTheDocument();\n });\n\n it('propagates value changes', async () => {\n const onChange = jest.fn();\n renderComponent({ pluginType: 'Panel', pluginKind: 'BertPanel1', value: { option1: 'Option1Value' }, onChange });\n\n const editor = await screen.findByLabelText('BertPanel1 editor');\n expect(editor).toHaveValue('Option1Value');\n userEvent.clear(editor);\n expect(onChange).toHaveBeenCalledWith({ option1: '' });\n });\n\n it('shows an error if plugin fails to load', async () => {\n renderComponent({ pluginType: 'Variable', pluginKind: 'DoesNotExist', value: {}, onChange: jest.fn() });\n const errorAlert = await screen.findByRole('alert');\n expect(errorAlert).toHaveTextContent(/doesnotexist/i);\n });\n});\n"],"names":["userEvent","screen","renderWithContext","PluginSpecEditor","describe","renderComponent","props","it","pluginType","pluginKind","value","onChange","jest","fn","editor","findByLabelText","expect","toBeInTheDocument","option1","toHaveValue","clear","toHaveBeenCalledWith","errorAlert","findByRole","toHaveTextContent"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,OAAOA,SAAS,MAAM,6BAA6B,CAAC;AACpD,SAASC,MAAM,QAAQ,wBAAwB,CAAC;AAChD,SAASC,iBAAiB,QAAQ,SAAS,CAAC;AAC5C,SAASC,gBAAgB,QAA+B,oBAAoB,CAAC;AAE7EC,QAAQ,CAAC,kBAAkB,EAAE,IAAM;IACjC,MAAMC,eAAe,GAAG,CAACC,KAA4B,GAAK;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