-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
surface conflicting env var names as warnings and errors
- Loading branch information
1 parent
5e854fe
commit a668a36
Showing
9 changed files
with
169 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...nd/src/pages/connectionTypes/manage/__tests__/ManageConnectionTypeFieldsTableRow.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import * as React from 'react'; | ||
import '@testing-library/jest-dom'; | ||
import { render, screen } from '@testing-library/react'; | ||
import ManageConnectionTypeFieldsTableRow from '~/pages/connectionTypes/manage/ManageConnectionTypeFieldsTableRow'; | ||
import { ShortTextField, TextField } from '~/concepts/connectionTypes/types'; | ||
|
||
const renderRow = ( | ||
props: Pick<React.ComponentProps<typeof ManageConnectionTypeFieldsTableRow>, 'row'> & | ||
Partial<React.ComponentProps<typeof ManageConnectionTypeFieldsTableRow>>, | ||
) => { | ||
const fn = jest.fn(); | ||
return ( | ||
<table> | ||
<tbody> | ||
<ManageConnectionTypeFieldsTableRow | ||
fields={[]} | ||
onAddField={fn} | ||
onChange={fn} | ||
onDelete={fn} | ||
onDragEnd={fn} | ||
onDragStart={fn} | ||
onDrop={fn} | ||
onDuplicate={fn} | ||
onEdit={fn} | ||
id="test" | ||
{...props} | ||
/> | ||
</tbody> | ||
</table> | ||
); | ||
}; | ||
|
||
describe('ManageConnectionTypeFieldsTableRow', () => { | ||
it('should display env variable conflict icon', () => { | ||
const field: ShortTextField = { | ||
type: 'short-text', | ||
name: 'test', | ||
envVar: 'test-envvar', | ||
properties: {}, | ||
}; | ||
const field2: TextField = { | ||
type: 'text', | ||
name: 'test-2', | ||
envVar: 'test-envvar', | ||
properties: {}, | ||
}; | ||
|
||
const result = render(renderRow({ row: field, fields: [field] })); | ||
expect(screen.getByTestId('field-env')).not.toHaveTextContent('conflict'); | ||
|
||
result.rerender(renderRow({ row: field, fields: [field, field2] })); | ||
expect(screen.getByTestId('field-env')).toHaveTextContent('conflict'); | ||
}); | ||
}); |
7 changes: 7 additions & 0 deletions
7
frontend/src/pages/connectionTypes/manage/fieldTableColumns.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const columns = [ | ||
'Section heading/field name', | ||
'Type', | ||
'Default value', | ||
'Environment variable', | ||
'Required', | ||
]; |