Files
twenty/packages/twenty-front/src/utils/__tests__/createApolloStoreFieldName.test.ts
T
Lucas BordeauandGitHub bba1b296c1 Refactor snackbar old component scoped state (#13183)
This PR refactors the snackbar modules that was using legacy versions of
our state management.

We replace the old states with new ones and also the old scoped context
with component instance context.
2025-07-11 16:05:09 +00:00

41 lines
1.1 KiB
TypeScript

import { createApolloStoreFieldName } from '~/utils/createApolloStoreFieldName';
describe('createApolloStoreFieldName', () => {
it('should create field name with simple variables', () => {
const result = createApolloStoreFieldName({
fieldName: 'users',
fieldVariables: { limit: 10 },
});
expect(result).toBe('users({"limit":10})');
});
it('should create field name with complex variables', () => {
const result = createApolloStoreFieldName({
fieldName: 'companies',
fieldVariables: {
filter: { name: { ilike: '%test%' } },
orderBy: [{ createdAt: 'DESC' }],
first: 20,
},
});
expect(result).toBe(
'companies({"filter":{"name":{"ilike":"%test%"}},"orderBy":[{"createdAt":"DESC"}],"first":20})',
);
});
it('should create field name with null and undefined values', () => {
const result = createApolloStoreFieldName({
fieldName: 'records',
fieldVariables: {
id: null,
name: undefined,
active: true,
},
});
expect(result).toBe('records({"id":null,"active":true})');
});
});