Skip to content

Commit

Permalink
chore: code smells (#534)
Browse files Browse the repository at this point in the history
* fix: code smells

* fix: remove commented code
  • Loading branch information
spaenleh authored Dec 11, 2024
1 parent 280b626 commit 9d1bcff
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 103 deletions.
8 changes: 0 additions & 8 deletions cypress/e2e/auth/logInWithPassword.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,4 @@ describe('Email and Password Validation', () => {
// Signing in with a valid email but empty password
cy.signInPasswordAndCheck(AUTH_MEMBERS.INVALID_PASSWORD);
});

// // Signing in with a valid email but empty password
// cy.signInPasswordAndCheck(AUTH_MEMBERS.WRONG_PASSWORD);
// // Signing in with a valid email and password
// cy.signInPasswordAndCheck(AUTH_MEMBERS.GRAASP);

// cy.get(`#${PASSWORD_SUCCESS_ALERT}`).should('be.visible');
// });
});
2 changes: 0 additions & 2 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,7 @@ Cypress.Commands.add(
getItemError || getCurrentMemberError,
);
mockGetItemChat({ chatMessages });
// mockGetItemMembershipsForItem(items, currentMember);

// mockGetItemsTags(items, currentMember);
mockGetLoginSchemaType(itemLogins);

mockGetChildren(items, currentMember);
Expand Down
88 changes: 0 additions & 88 deletions cypress/support/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,54 +490,6 @@ export const mockGetItemChat = ({
).as('getItemChat');
};

// export const mockGetItemMembershipsForItem = (
// items: MockItem[],
// currentMember: Member | null,
// ): void => {
// cy.intercept(
// {
// method: HttpMethod.Get,
// url: new RegExp(
// `${API_HOST}/${parseStringToRegExp(
// buildGetItemMembershipsForItemsRoute([]),
// )}`,
// ),
// },
// ({ reply, url }) => {
// const itemIds = new URLSearchParams(new URL(url).search).getAll('itemId');
// const selectedItems = items.filter(({ id }) => itemIds?.includes(id));
// const allMemberships = selectedItems.map(
// ({ creator, id, memberships }) => {
// // build default membership depending on current member
// // if the current member is the creator, it has membership
// // otherwise it should return an error
// const defaultMembership =
// creator?.id === currentMember?.id
// ? [
// {
// permission: PermissionLevel.Admin,
// memberId: creator,
// itemId: id,
// },
// ]
// : { statusCode: StatusCodes.UNAUTHORIZED };

// // if the defined memberships does not contain currentMember, it should throw
// const currentMemberHasMembership = memberships?.find(
// ({ memberId }) => memberId === currentMember?.id,
// );
// if (!currentMemberHasMembership) {
// return defaultMembership;
// }

// return memberships || defaultMembership;
// },
// );
// reply(allMemberships);
// },
// ).as('getItemMemberships');
// };

export const mockGetChildren = (
items: MockItem[],
member: Member | null,
Expand Down Expand Up @@ -648,46 +600,6 @@ export const mockDefaultDownloadFile = (
).as('downloadFile');
};

// export const mockGetItemsTags = (
// items: MockItem[],
// member: Member | null,
// ): void => {
// cy.intercept(
// {
// method: HttpMethod.Get,
// url: new RegExp(`${API_HOST}/items/tags\\?id\\=`),
// },
// ({ reply, url }) => {
// const ids = new URL(url).searchParams.getAll('id');

// const result = items
// .filter(({ id }) => ids.includes(id))
// .reduce(
// (acc, item) => {
// const error = checkMemberHasAccess({ item, items, member });

// return isError(error)
// ? { ...acc, error: [...acc.errors, error] }
// : {
// ...acc,
// data: {
// ...acc.data,
// [item.id]: ([item.public, item.hidden]
// .filter(Boolean)
// .map((t) => ({ item, ...t })) ?? []) as ItemVisibility[],
// },
// };
// },
// { data: {}, errors: [] } as ResultOf<ItemVisibility[]>,
// );
// reply({
// statusCode: StatusCodes.OK,
// body: result,
// });
// },
// ).as('getItemsTags');
// };

export const mockGetLoginSchemaType = (itemLogins: {
[key: string]: string;
}): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/locales/fr/landing.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
"CONTENT": {
"TITLE": "Contenu",
"HOME": "Accueil",
"FEATURES": "Fonctionnalité",
"FEATURES": "Fonctionnalités",
"ABOUT_US": "À propos de nous",
"SUPPORT": "Support utilisateur",
"CONTACT_US": "Contactez-nous"
Expand Down
2 changes: 1 addition & 1 deletion src/modules/landing/features/CallOutSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function CallOutSection({
children,
actions,
image,
}: CallOutSectionProps) {
}: Readonly<CallOutSectionProps>) {
return (
<StyledStack gap={4} width="100%">
<Stack flex={1} overflow="hidden" borderRadius={4}>
Expand Down
2 changes: 1 addition & 1 deletion src/modules/landing/features/pricing/IncludedOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useButtonColor } from '@graasp/ui';

import { CheckIcon } from 'lucide-react';

export function IncludedOption({ text }: { text: string }) {
export function IncludedOption({ text }: Readonly<{ text: string }>) {
const { color } = useButtonColor('success');

return (
Expand Down
2 changes: 1 addition & 1 deletion src/modules/landing/features/pricing/PlanLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function PlanLayout({
name,
price,
children,
}: PlanLayoutProps): JSX.Element {
}: Readonly<PlanLayoutProps>): JSX.Element {
return (
<StyledStack borderRadius={4} p={4} gap={4} flex={1} alignItems="center">
<Typography variant="h4" component="span">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function PricingPlan({
support,
templates,
price,
}: PricingPlanProps) {
}: Readonly<PricingPlanProps>) {
return (
<PlanLayout name={name} price={price}>
<IncludedOption text={storage} />
Expand Down

0 comments on commit 9d1bcff

Please sign in to comment.