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:
@ -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})');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user