Refresh comments threads and count on new comment (#276)

* Refresh comments threads and count on new comment

* Fix tests
This commit is contained in:
Charles Bochet
2023-06-12 19:32:18 +02:00
committed by GitHub
parent 3341539eb2
commit 16e1b862d9
17 changed files with 74 additions and 181 deletions

View File

@ -4,11 +4,6 @@ import { GraphqlQueryCompany } from '@/companies/interfaces/company.interface';
import { GraphqlQueryPerson } from '@/people/interfaces/person.interface';
import { GraphqlQueryUser } from '@/users/interfaces/user.interface';
import {
GetCompanyCommentsCountQuery,
GetPeopleCommentsCountQuery,
} from '../generated/graphql';
import { mockedCompaniesData } from './mock-data/companies';
import { mockedPeopleData } from './mock-data/people';
import { mockedUsersData } from './mock-data/users';
@ -98,17 +93,4 @@ export const graphqlMocks = [
}),
);
}),
graphql.query('GetPeopleCommentsCount', (req, res, ctx) => {
const mockedData: GetPeopleCommentsCountQuery = {
people: [{ commentsCount: 12 }],
};
return res(ctx.data(mockedData));
}),
graphql.query('GetCompanyCommentsCount', (req, res, ctx) => {
const mockedData: GetCompanyCommentsCountQuery = {
companies: [{ commentsCount: 20 }],
};
return res(ctx.data(mockedData));
}),
];

View File

@ -8,6 +8,7 @@ export const mockedCompaniesData: Array<GraphqlQueryCompany> = [
createdAt: '2023-04-26T10:08:54.724515+00:00',
address: '17 rue de clignancourt',
employees: 12,
_commentCount: 1,
accountOwner: {
email: 'charles@test.com',
displayName: 'Charles Test',
@ -23,6 +24,7 @@ export const mockedCompaniesData: Array<GraphqlQueryCompany> = [
createdAt: '2023-04-26T10:12:42.33625+00:00',
address: '',
employees: 1,
_commentCount: 1,
accountOwner: null,
__typename: 'companies',
},
@ -33,6 +35,7 @@ export const mockedCompaniesData: Array<GraphqlQueryCompany> = [
createdAt: '2023-04-26T10:10:32.530184+00:00',
address: '',
employees: 1,
_commentCount: 1,
accountOwner: null,
__typename: 'companies',
},
@ -43,6 +46,7 @@ export const mockedCompaniesData: Array<GraphqlQueryCompany> = [
createdAt: '2023-03-21T06:30:25.39474+00:00',
address: '',
employees: 10,
_commentCount: 0,
accountOwner: null,
__typename: 'companies',
},
@ -53,6 +57,7 @@ export const mockedCompaniesData: Array<GraphqlQueryCompany> = [
createdAt: '2023-04-26T10:13:29.712485+00:00',
address: '10 rue de la Paix',
employees: 1,
_commentCount: 2,
accountOwner: null,
__typename: 'companies',
},
@ -63,6 +68,7 @@ export const mockedCompaniesData: Array<GraphqlQueryCompany> = [
createdAt: '2023-04-26T10:09:25.656555+00:00',
address: '',
employees: 1,
_commentCount: 13,
accountOwner: null,
__typename: 'companies',
},
@ -73,6 +79,7 @@ export const mockedCompaniesData: Array<GraphqlQueryCompany> = [
createdAt: '2023-04-26T10:09:25.656555+00:00',
address: '',
employees: 1,
_commentCount: 1,
accountOwner: null,
__typename: 'companies',
},

View File

@ -14,6 +14,7 @@ export const mockedPeopleData = [
__typename: 'Company',
},
phone: '06 12 34 56 78',
_commentCount: 1,
createdAt: '2023-04-20T13:20:09.158312+00:00',
city: 'Paris',
@ -31,6 +32,7 @@ export const mockedPeopleData = [
__typename: 'Company',
},
phone: '06 12 34 56 78',
_commentCount: 1,
createdAt: '2023-04-20T13:20:09.158312+00:00',
city: 'Paris',
@ -48,6 +50,7 @@ export const mockedPeopleData = [
__typename: 'Company',
},
phone: '06 12 34 56 78',
_commentCount: 1,
createdAt: '2023-04-20T13:20:09.158312+00:00',
city: 'Paris',
@ -66,6 +69,7 @@ export const mockedPeopleData = [
__typename: 'Company',
},
phone: '06 12 34 56 78',
_commentCount: 2,
createdAt: '2023-04-20T13:20:09.158312+00:00',
city: 'Paris',