Skip to content

Commit

Permalink
Fix front jest tests (twentyhq#5331)
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesBochet authored May 7, 2024
1 parent bb995d5 commit eef497c
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 18 deletions.
1 change: 1 addition & 0 deletions .github/workflows/actions/task-cache/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ runs:
.nx/cache
node_modules/.cache
packages/*/node_modules/.cache
packages/twenty-front/storybook-static
key: tasks-cache-${{ github.ref_name }}-${{ inputs.tag }}-${{ steps.tasks-key.outputs.key }}${{ inputs.suffix }}-${{ github.sha }}
restore-keys: |
tasks-cache-${{ github.ref_name }}-${{ inputs.tag }}-${{ steps.tasks-key.outputs.key }}${{ inputs.suffix }}-
2 changes: 1 addition & 1 deletion .github/workflows/ci-front.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ concurrency:

jobs:
front-sb-build:
runs-on: ubuntu-latest
runs-on: ci-8-cores
env:
REACT_APP_SERVER_BASE_URL: http://localhost:3000
steps:
Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-front/nyc.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const modulesCoverage = {
};

const pagesCoverage = {
branches: 45,
branches: 40,
statements: 60,
lines: 60,
functions: 45,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { gql } from '@apollo/client';
import { mockedPeopleData } from '~/testing/mock-data/people';

export const query = gql`
query FindDuplicatePerson($id: UUID) {
query FindDuplicatePerson($id: ID!) {
personDuplicates(id: $id) {
edges {
node {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ const expectedQueryTemplate = `
describe('useCreateManyRecordsMutation', () => {
it('should return a valid createManyRecordsMutation', () => {
const objectNameSingular = 'person';
const depth = 2;

const { result } = renderHook(
() =>
useCreateManyRecordsMutation({
objectNameSingular,
depth,
}),
{
wrapper: RecoilRoot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ const expectedQueryTemplate = `
describe('useCreateOneRecordMutation', () => {
it('should return a valid createOneRecordMutation', () => {
const objectNameSingular = 'person';
const depth = 2;

const { result } = renderHook(
() =>
useCreateOneRecordMutation({
objectNameSingular,
depth,
}),
{
wrapper: RecoilRoot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RecoilRoot } from 'recoil';
import { useDeleteOneRecordMutation } from '@/object-record/hooks/useDeleteOneRecordMutation';

const expectedQueryTemplate = `
mutation DeleteOnePerson($idToDelete: UUID!) {
mutation DeleteOnePerson($idToDelete: ID!) {
deletePerson(id: $idToDelete) {
id
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RecoilRoot } from 'recoil';
import { useExecuteQuickActionOnOneRecordMutation } from '@/object-record/hooks/useExecuteQuickActionOnOneRecordMutation';

const expectedQueryTemplate = `
mutation ExecuteQuickActionOnOnePerson($idToExecuteQuickActionOn: UUID!) {
mutation ExecuteQuickActionOnOnePerson($idToExecuteQuickActionOn: ID!) {
executeQuickActionOnPerson(id: $idToExecuteQuickActionOn) {
__typename
xLink {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RecoilRoot } from 'recoil';
import { useFindDuplicateRecordsQuery } from '@/object-record/hooks/useFindDuplicatesRecordsQuery';

const expectedQueryTemplate = `
query FindDuplicatePerson($id: UUID) {
query FindDuplicatePerson($id: ID!) {
personDuplicates(id: $id) {
edges {
node {
Expand Down Expand Up @@ -47,13 +47,11 @@ const expectedQueryTemplate = `
describe('useFindDuplicateRecordsQuery', () => {
it('should return a valid findDuplicateRecordsQuery', () => {
const objectNameSingular = 'person';
const depth = 2;

const { result } = renderHook(
() =>
useFindDuplicateRecordsQuery({
objectNameSingular,
depth,
}),
{
wrapper: RecoilRoot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RecoilRoot } from 'recoil';
import { useFindManyRecordsQuery } from '@/object-record/hooks/useFindManyRecordsQuery';

const expectedQueryTemplate = `
query FindManyPeople($filter: PersonFilterInput, $orderBy: PersonOrderByInput, $lastCursor: String, $limit: Float) {
query FindManyPeople($filter: PersonFilterInput, $orderBy: PersonOrderByInput, $lastCursor: String, $limit: Int) {
people(filter: $filter, orderBy: $orderBy, first: $limit, after: $lastCursor) {
edges {
node {
Expand Down Expand Up @@ -47,14 +47,12 @@ const expectedQueryTemplate = `
describe('useFindManyRecordsQuery', () => {
it('should return a valid findManyRecordsQuery', () => {
const objectNameSingular = 'person';
const depth = 2;
const computeReferences = true;

const { result } = renderHook(
() =>
useFindManyRecordsQuery({
objectNameSingular,
depth,
computeReferences,
}),
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RecoilRoot } from 'recoil';
import { useFindOneRecordQuery } from '@/object-record/hooks/useFindOneRecordQuery';

const expectedQueryTemplate = `
query FindOnePerson($objectRecordId: UUID!) {
query FindOnePerson($objectRecordId: ID!) {
person(filter: { id: { eq: $objectRecordId } }) {
__typename
xLink {
Expand Down Expand Up @@ -36,13 +36,11 @@ query FindOnePerson($objectRecordId: UUID!) {
describe('useFindOneRecordQuery', () => {
it('should return a valid findOneRecordQuery', () => {
const objectNameSingular = 'person';
const depth = 2;

const { result } = renderHook(
() =>
useFindOneRecordQuery({
objectNameSingular,
depth,
}),
{
wrapper: RecoilRoot,
Expand Down

0 comments on commit eef497c

Please sign in to comment.