chore: Replace globalConfig Mixin with useGlobalConfig Composable

This commit is contained in:
Fayaz Ahmed
2024-08-20 07:53:21 +05:30
parent 8473e72a7e
commit c798474f2b
18 changed files with 142 additions and 42 deletions
@@ -0,0 +1,39 @@
import { useGlobalConfig } from '../useGlobalConfig';
describe('useGlobalConfig', () => {
it('should return the string with the installation name', () => {
const str = 'Chatwoot is awesome';
const installationName = 'Acme Inc';
const { useInstallationName } = useGlobalConfig();
expect(useInstallationName(str, installationName)).toBe(
'Acme Inc is awesome'
);
});
it('should return the string without the installation name', () => {
const str = 'Chatwoot is awesome';
const installationName = '';
const { useInstallationName } = useGlobalConfig();
expect(useInstallationName(str, installationName)).toBe(
'Chatwoot is awesome'
);
});
it('should handle null installation name properly', () => {
const str = 'Chatwoot is super cool';
const installationName = null;
const { useInstallationName } = useGlobalConfig();
expect(useInstallationName(str, installationName)).toBe(
'Chatwoot is super cool'
);
});
it('should handle undefined installation name properly', () => {
const str = 'Chatwoot is super cool';
const installationName = undefined;
const { useInstallationName } = useGlobalConfig();
expect(useInstallationName(str, installationName)).toBe(
'Chatwoot is super cool'
);
});
});