Skip to content

Commit

Permalink
Merge branch 'main' into feat/data-explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-elias committed Aug 11, 2024
2 parents 1c637af + 39512a7 commit c2cbf95
Show file tree
Hide file tree
Showing 71 changed files with 631 additions and 1,179 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"@sentry/tracing": "^7.99.0",
"@sniptt/guards": "^0.2.0",
"@stoplight/elements": "^8.0.5",
"@storybook/icons": "^1.2.9",
"@swc/jest": "^0.2.29",
"@tabler/icons-react": "^2.44.0",
"@types/dompurify": "^3.0.5",
Expand Down Expand Up @@ -190,7 +189,7 @@
"stripe": "^14.17.0",
"ts-key-enum": "^2.0.12",
"tslib": "^2.3.0",
"tsup": "^8.0.1",
"tsup": "^8.2.4",
"type-fest": "4.10.1",
"typeorm": "patch:[email protected]#./packages/twenty-server/patches/typeorm+0.3.20.patch",
"typescript": "5.3.3",
Expand Down Expand Up @@ -234,6 +233,7 @@
"@storybook/addon-onboarding": "^1.0.10",
"@storybook/blocks": "^7.6.3",
"@storybook/core-server": "7.6.3",
"@storybook/icons": "^1.2.9",
"@storybook/jest": "^0.2.3",
"@storybook/react": "^7.6.3",
"@storybook/react-vite": "^7.6.3",
Expand Down Expand Up @@ -297,7 +297,7 @@
"danger": "^11.3.0",
"dotenv-cli": "^7.2.1",
"drizzle-kit": "^0.20.14",
"esbuild": "^0.20.2",
"esbuild": "^0.23.0",
"eslint": "^8.53.0",
"eslint-config-next": "14.0.4",
"eslint-config-prettier": "^9.1.0",
Expand Down Expand Up @@ -329,14 +329,14 @@
"storybook": "^7.6.3",
"storybook-addon-cookie": "^3.2.0",
"storybook-addon-pseudo-states": "^2.1.2",
"storybook-dark-mode": "^4.0.1",
"storybook-dark-mode": "^3.0.3",
"supertest": "^6.1.3",
"ts-jest": "^29.1.1",
"ts-loader": "^9.2.3",
"ts-node": "10.9.1",
"tsconfig-paths": "^4.2.0",
"tsx": "^4.7.2",
"vite": "^5.0.0",
"tsx": "^4.17.0",
"vite": "^5.4.0",
"vite-plugin-checker": "^0.6.2",
"vite-plugin-dts": "3.8.1",
"vite-plugin-svgr": "^4.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type ContainerProps = {
const StyledContainer = styled.div<ContainerProps>`
align-items: center;
background-color: ${({ theme, isOn, color }) =>
isOn ? color ?? theme.color.blue : theme.background.quaternary};
isOn ? (color ?? theme.color.blue) : theme.background.quaternary};
border-radius: 10px;
cursor: pointer;
display: flex;
Expand Down
6 changes: 3 additions & 3 deletions packages/twenty-front/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const jestConfig: JestConfigWithTsJest = {
extensionsToTreatAsEsm: ['.ts', '.tsx'],
coverageThreshold: {
global: {
statements: 64,
lines: 63,
functions: 55,
statements: 62,
lines: 61,
functions: 52,
},
},
collectCoverageFrom: ['<rootDir>/src/**/*.ts'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { expect } from '@storybook/jest';
import { Meta, StoryObj } from '@storybook/react';
import { within } from '@storybook/test';

Expand All @@ -7,7 +6,6 @@ import {
PageDecorator,
PageDecoratorArgs,
} from '~/testing/decorators/PageDecorator';
import { PrefetchLoadingDecorator } from '~/testing/decorators/PrefetchLoadingDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';

const meta: Meta<PageDecoratorArgs> = {
Expand All @@ -31,17 +29,15 @@ export type Story = StoryObj<typeof RecordIndexPage>;
export const Default: Story = {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
decorators: [PrefetchLoadingDecorator, PageDecorator],
decorators: [PageDecorator],
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

await canvas.findByText('Search');
await canvas.findByText('Settings');
await canvas.findByText('Tasks');

expect(canvas.queryByText('People')).toBeNull();
expect(canvas.queryByText('Opportunities')).toBeNull();
expect(canvas.queryByText('Listings')).toBeNull();
expect(canvas.queryByText('My Customs')).toBeNull();
await canvas.findByText('People');
await canvas.findByText('Opportunities');
await canvas.findByText('My Customs');
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { loggerLink } from '../utils';
const logger = loggerLink(() => 'Twenty');

export interface Options<TCacheShape> extends ApolloClientOptions<TCacheShape> {
onError?: (err: GraphQLFormattedError | undefined) => void;
onError?: (err: readonly GraphQLFormattedError[] | undefined) => void;
onNetworkError?: (err: Error | ServerParseError | ServerError) => void;
onTokenPairChange?: (tokenPair: AuthTokenPair) => void;
onUnauthenticatedError?: () => void;
Expand Down Expand Up @@ -80,9 +80,8 @@ export class ApolloFactory<TCacheShape> implements ApolloManager<TCacheShape> {
const errorLink = onError(
({ graphQLErrors, networkError, forward, operation }) => {
if (isDefined(graphQLErrors)) {
onErrorCb?.(graphQLErrors);
for (const graphQLError of graphQLErrors) {
onErrorCb?.(graphQLError);

if (graphQLError.message === 'Unauthorized') {
return fromPromise(
renewToken(uri, this.tokenPair)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect } from 'react';
import { action } from '@storybook/addon-actions';
import { Meta, StoryObj } from '@storybook/react';
import { expect, userEvent, within } from '@storybook/test';
import { useEffect } from 'react';
import { useSetRecoilState } from 'recoil';
import { IconCheckbox, IconNotes } from 'twenty-ui';

Expand All @@ -14,7 +14,6 @@ import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadat
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { getCompaniesMock } from '~/testing/mock-data/companies';
import { getPeopleMock } from '~/testing/mock-data/people';
import {
mockDefaultWorkspace,
mockedWorkspaceMemberData,
Expand All @@ -23,7 +22,6 @@ import { sleep } from '~/utils/sleep';

import { CommandMenu } from '../CommandMenu';

const peopleMock = getPeopleMock();
const companiesMock = getCompaniesMock();

const openTimeout = 50;
Expand Down Expand Up @@ -99,13 +97,8 @@ export const MatchingPersonCompanyActivityCreateNavigate: Story = {
const searchInput = await canvas.findByPlaceholderText('Search');
await sleep(openTimeout);
await userEvent.type(searchInput, 'n');
expect(
await canvas.findByText(
peopleMock[0].name.firstName + ' ' + peopleMock[0].name.lastName,
),
).toBeInTheDocument();
expect(await canvas.findByText('Linkedin')).toBeInTheDocument();
expect(await canvas.findByText(companiesMock[0].name)).toBeInTheDocument();
expect(await canvas.findByText('My very first note')).toBeInTheDocument();
expect(await canvas.findByText('Create Note')).toBeInTheDocument();
expect(await canvas.findByText('Go to Companies')).toBeInTheDocument();
},
Expand All @@ -128,21 +121,6 @@ export const AtleastMatchingOnePerson: Story = {
const searchInput = await canvas.findByPlaceholderText('Search');
await sleep(openTimeout);
await userEvent.type(searchInput, 'alex');
expect(
await canvas.findByText(
peopleMock[0].name.firstName + ' ' + peopleMock[0].name.lastName,
),
).toBeInTheDocument();
},
};

export const NotMatchingAnything: Story = {
play: async () => {
const canvas = within(document.body);
const searchInput = await canvas.findByPlaceholderText('Search');
await sleep(openTimeout);
await userEvent.type(searchInput, 'asdasdasd');
// FIXME: We need to fix the filters in graphql
// expect(await canvas.findByText('No results found')).toBeInTheDocument();
expect(await canvas.findByText('Sylvie Palmer')).toBeInTheDocument();
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadat
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';

import { PrefetchLoadedDecorator } from '~/testing/decorators/PrefetchLoadedDecorator';
import { ObjectMetadataNavItems } from '../ObjectMetadataNavItems';

const meta: Meta<typeof ObjectMetadataNavItems> = {
Expand All @@ -20,6 +21,7 @@ const meta: Meta<typeof ObjectMetadataNavItems> = {
ComponentWithRouterDecorator,
ComponentWithRecoilScopeDecorator,
SnackBarDecorator,
PrefetchLoadedDecorator,
],
parameters: {
msw: graphqlMocks,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit c2cbf95

Please sign in to comment.