test: add test for invalid cal video (#13103)
* test: add test for invalid cal video * chore: add confirm * chore: fix type error * chore: update code * test: add unit test * chore: type error * chore * chore: type * chore: fix test * chore --------- Co-authored-by: Carina Wollendorfer <[email protected]>
This commit is contained in:
1 parent
13a765e50a
commit
7ec3d04acc
6 files changed
+112
-7
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { getCalVideoReference } from "./get-cal-video-reference";
|
||||
|
||||
describe("Cal Video", () => {
|
||||
it("should load latest cal video reference", () => {
|
||||
expect(
|
||||
getCalVideoReference([
|
||||
{
|
||||
uid: "UID1",
|
||||
type: "daily_video",
|
||||
meetingUrl: "ID1",
|
||||
meetingPassword: "P1",
|
||||
},
|
||||
{
|
||||
uid: "UID2",
|
||||
type: "daily_video",
|
||||
meetingUrl: "ID2",
|
||||
meetingPassword: "P2",
|
||||
},
|
||||
])
|
||||
).toEqual({
|
||||
uid: "UID2",
|
||||
type: "daily_video",
|
||||
meetingUrl: "ID2",
|
||||
meetingPassword: "P2",
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
export type Reference = {
|
||||
uid: string;
|
||||
type: string;
|
||||
meetingUrl: string | null;
|
||||
meetingPassword: string | null;
|
||||
};
|
||||
|
||||
export const getCalVideoReference = (references: Reference[]) => {
|
||||
const videoReferences = references.filter((reference) => reference.type.includes("_video"));
|
||||
const latestVideoReference = videoReferences[videoReferences.length - 1];
|
||||
return latestVideoReference;
|
||||
};
|
||||
@@ -21,6 +21,7 @@ export type ActionType = {
|
||||
label: string;
|
||||
disabled?: boolean;
|
||||
color?: ButtonBaseProps["color"];
|
||||
bookingId?: number;
|
||||
} & (
|
||||
| { href: string; onClick?: never; actions?: never }
|
||||
| { href?: never; onClick: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void; actions?: never }
|
||||
@@ -61,6 +62,7 @@ export const DropdownActions = ({
|
||||
data-testid={action.id}
|
||||
StartIcon={action.icon}
|
||||
href={action.href}
|
||||
data-bookingid={action.bookingId}
|
||||
onClick={action.onClick || defaultAction}>
|
||||
{action.label}
|
||||
</DropdownItem>
|
||||
@@ -87,6 +89,7 @@ export const TableActions: FC<Props> = ({ actions }) => {
|
||||
StartIcon={action.icon}
|
||||
{...(action?.actions ? { EndIcon: ChevronDown } : null)}
|
||||
disabled={action.disabled}
|
||||
data-bookingid={action.bookingId}
|
||||
color={action.color || "secondary"}>
|
||||
{action.label}
|
||||
</Button>
|
||||
|
||||
Reference in new issue
Block a user