From 5b45b62994ca4e1fa8c77370830d509c2d0e1d28 Mon Sep 17 00:00:00 2001 From: Poojan Date: Fri, 27 Feb 2026 07:57:46 +0530 Subject: [PATCH] test: improve coverage for header components (#32628) --- web/app/components/base/switch/index.tsx | 13 +- .../edit-workspace-modal/index.spec.tsx | 43 +- .../edit-workspace-modal/index.tsx | 8 +- .../members-page/index.spec.tsx | 89 ++ .../account-setting/members-page/index.tsx | 30 +- .../members-page/invite-modal/index.spec.tsx | 101 +- .../members-page/invite-modal/index.tsx | 21 +- .../invite-modal/role-selector.spec.tsx | 65 +- .../invite-modal/role-selector.tsx | 41 +- .../invited-modal/invitation-link.spec.tsx | 76 +- .../invited-modal/invitation-link.tsx | 6 +- .../transfer-ownership-modal/index.spec.tsx | 127 +- .../transfer-ownership-modal/index.tsx | 54 +- .../member-selector.spec.tsx | 116 +- .../member-selector.tsx | 22 +- .../model-provider-page/hooks.spec.ts | 1361 ++++++++++++++++- .../provider-added-card/index.spec.tsx | 87 +- .../provider-added-card/index.tsx | 20 +- .../model-load-balancing-configs.spec.tsx | 174 ++- .../model-load-balancing-configs.tsx | 15 +- web/eslint-suppressions.json | 22 - 21 files changed, 2145 insertions(+), 346 deletions(-) diff --git a/web/app/components/base/switch/index.tsx b/web/app/components/base/switch/index.tsx index 8c900bb123..20ac963950 100644 --- a/web/app/components/base/switch/index.tsx +++ b/web/app/components/base/switch/index.tsx @@ -4,11 +4,12 @@ import * as React from 'react' import { cn } from '@/utils/classnames' type SwitchProps = { - value: boolean - onChange?: (value: boolean) => void - size?: 'xs' | 'sm' | 'md' | 'lg' | 'l' - disabled?: boolean - className?: string + 'value': boolean + 'onChange'?: (value: boolean) => void + 'size'?: 'xs' | 'sm' | 'md' | 'lg' | 'l' + 'disabled'?: boolean + 'className'?: string + 'data-testid'?: string } const Switch = ( @@ -19,6 +20,7 @@ const Switch = ( size = 'md', disabled = false, className, + 'data-testid': dataTestid, }: SwitchProps & { ref?: React.RefObject }, @@ -56,6 +58,7 @@ const Switch = ( onChange?.(checked) }} className={cn(wrapStyle[size], value ? 'bg-components-toggle-bg' : 'bg-components-toggle-bg-unchecked', 'relative inline-flex shrink-0 cursor-pointer rounded-[5px] border-2 border-transparent transition-colors duration-200 ease-in-out', disabled ? '!cursor-not-allowed !opacity-50' : '', size === 'xs' && 'rounded-sm', className)} + data-testid={dataTestid} >