Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet committed Nov 15, 2021
1 parent 2d44716 commit 02cd376
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ const args: Args = {
export const FleetServerHostsFlyout = ({ width }: Args) => {
return (
<div style={{ width }}>
<Component onClose={() => {}} />
<Component
onClose={() => {}}
fleetServerHosts={['https://host1.fr:8220', 'https://host2-with-a-longer-name.fr:8220']}
/>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,6 @@ import { useConfirmModal } from '../../hooks/use_confirm_modal';

const URL_REGEX = /^(https?):\/\/[^\s$.?#].[^\s]*$/gm;

// function normalizeHosts(hostsInput: string[]) {
// return hostsInput.map((host) => {
// try {
// return normalizeHostsForAgents(host);
// } catch (err) {
// return host;
// }
// });
// }

// function isSameArrayValueWithNormalizedHosts(arrayA: string[] = [], arrayB: string[] = []) {
// const hostsA = normalizeHosts(arrayA);
// const hostsB = normalizeHosts(arrayB);
// return hostsA.length === hostsB.length && hostsA.every((val, index) => val === hostsB[index]);
// }

function validateFleetServerHosts(value: string[]) {
if (value.length === 0) {
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ const ModalContext = React.createContext<null | {
export function useConfirmModal() {
const context = useContext(ModalContext);

if (context === null) {
throw new Error('Context need to be provided to use useConfirmModal');
}

const confirm = useCallback(
async (title: React.ReactNode, description: React.ReactNode) => {
if (context === null) {
throw new Error('Context need to be provided to use useConfirmModal');
}
return new Promise<boolean>((resolve) => {
context.showModal({
title,
Expand Down

0 comments on commit 02cd376

Please sign in to comment.