Skip to content

Commit

Permalink
SSH Tunnel UI:
Browse files Browse the repository at this point in the history
- Fix bug on DB edition for dbs with ssh tunnels: If the feature flag is OFF the toggle wouldn't show but the rest of the form fields would
- Add test that check that if no toggle is in the document, then the rest of fields must not be in the document as well
  • Loading branch information
Antonio-RiveroMartnez committed Feb 6, 2023
1 parent 7a0f350 commit 49bd009
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,27 @@ describe('DatabaseModal', () => {
expect(allowFileUploadText).not.toBeInTheDocument();
expect(schemasForFileUploadText).not.toBeInTheDocument();
});

it('if the SSH Tunneling toggle is not displayed, nothing should get displayed', async () => {
const SSHTunnelingToggle = screen.queryByTestId('ssh-tunnel-switch');
expect(SSHTunnelingToggle).not.toBeInTheDocument();
const SSHTunnelServerAddressInput = screen.queryByTestId(
'ssh-tunnel-server_address-input',
);
expect(SSHTunnelServerAddressInput).not.toBeInTheDocument();
const SSHTunnelServerPortInput = screen.queryByTestId(
'ssh-tunnel-server_port-input',
);
expect(SSHTunnelServerPortInput).not.toBeInTheDocument();
const SSHTunnelUsernameInput = screen.queryByTestId(
'ssh-tunnel-username-input',
);
expect(SSHTunnelUsernameInput).not.toBeInTheDocument();
const SSHTunnelPasswordInput = screen.queryByTestId(
'ssh-tunnel-password-input',
);
expect(SSHTunnelPasswordInput).not.toBeInTheDocument();
});
});

describe('DatabaseModal w errors as objects', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
}, [passwordsNeeded]);

useEffect(() => {
if (db) {
if (db && isSSHTunneling) {
setUseSSHTunneling(!isEmpty(db?.ssh_tunnel));
}
}, [db]);
Expand Down

0 comments on commit 49bd009

Please sign in to comment.