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.
This commit is contained in:
Lucas Bordeau
2025-07-11 18:05:09 +02:00
committed by GitHub
parent 69a6f4471e
commit bba1b296c1
23 changed files with 554 additions and 178 deletions

View File

@ -0,0 +1,40 @@
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})');
});
});