Skip to content

Commit

Permalink
Add ResourceSelector component (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
andresmgot authored Nov 8, 2021
1 parent 755cf97 commit 8167026
Show file tree
Hide file tree
Showing 11 changed files with 1,155 additions and 1,562 deletions.
7 changes: 6 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@

const standard = require('@grafana/toolkit/src/config/jest.plugin.config');

const config = standard.jestConfig();

// allows us to have our own custom set up test file
config.setupFilesAfterEnv = ['<rootDir>/src/tests/setupTests.ts'];

// This process will use the same config that `yarn test` is using
module.exports = standard.jestConfig();
module.exports = config;
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"@babel/preset-env": "^7.13.12",
"@babel/preset-react": "^7.13.13",
"@babel/preset-typescript": "^7.13.0",
"@grafana/data": "^7.5.0",
"@grafana/toolkit": "^7.5.1",
"@grafana/data": "^8.2.1",
"@grafana/toolkit": "^8.2.1",
"@grafana/tsconfig": "^1.0.0-rc1",
"@grafana/ui": "^7.5.0",
"@grafana/ui": "^8.2.1",
"@rollup/plugin-commonjs": "11.0.2",
"@rollup/plugin-json": "4.0.3",
"@rollup/plugin-node-resolve": "7.1.1",
Expand All @@ -48,6 +48,7 @@
"babel-jest": "^26.6.3",
"jest": "^26.6.3",
"pretty-format": "25.1.0",
"react-select-event": "^5.3.0",
"react-test-renderer": "^17.0.2",
"rimraf": "^3.0.2",
"rollup": "2.0.6",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const buildCjsPackage = ({ env }) => {
},
},
],
external: ['react', '@grafana/data', '@grafana/ui'],
external: ['react', '@grafana/data', '@grafana/ui', 'lodash'],
plugins: [
typescript({
rollupCommonJSResolveHack: false,
Expand Down
9 changes: 1 addition & 8 deletions src/ConnectionConfig.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import '@testing-library/jest-dom/extend-expect';
import React from 'react';
import renderer from 'react-test-renderer';
import { render, screen, waitFor } from '@testing-library/react';
import { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData, AwsAuthType } from './types';
import { ConnectionConfig, ConnectionConfigProps } from './ConnectionConfig';
Expand All @@ -10,6 +9,7 @@ const getProps = (propOverrides?: object) => {
options: {
id: 21,
typeName: 'aws',
uid: '',
orgId: 1,
name: 'aws-plugin-name',
type: 'aws',
Expand Down Expand Up @@ -66,13 +66,6 @@ describe('ConnectionConfig', () => {
beforeEach(() => resetWindow());
afterEach(() => resetWindow());

it('should render component', () => {
const props = getProps();
const tree = renderer.create(<ConnectionConfig {...props} />).toJSON();

expect(tree).toMatchSnapshot();
});

it('should use auth type from props if its set', async () => {
const onOptionsChange = jest.fn();
const props = getProps({ onOptionsChange, options: { jsonData: { authType: AwsAuthType.Keys } } });
Expand Down
309 changes: 0 additions & 309 deletions src/__snapshots__/ConnectionConfig.test.tsx.snap

This file was deleted.

1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { ConnectionConfig, ConnectionConfigProps } from './ConnectionConfig';
export { ResourceSelector, ResourceSelectorProps } from './sql/ResourceSelector';
export * from './types';
export * from './regions';
export * from './providers';
Loading

0 comments on commit 8167026

Please sign in to comment.