| 12345678910111213141516171819202122232425 |
- import { assetUrl } from '@/utils/assetUrl';
- describe('assetUrl', () => {
- const originalWindow = global.window;
- afterEach(() => {
- global.window = originalWindow;
- });
- test('combines the configured asset base with the public image path', () => {
- global.window = { SITE_CONFIG: { assetURL: 'https://transcend.ringzle.com/web/assets' } };
- expect(assetUrl('fm_logo.png')).toBe(
- 'https://transcend.ringzle.com/web/assets/images/fm_logo.png'
- );
- });
- test('normalizes duplicate slashes in the configured base', () => {
- global.window = { SITE_CONFIG: { assetURL: 'https://transcend.ringzle.com/web/assets/' } };
- expect(assetUrl('/fm_logo.png')).toBe(
- 'https://transcend.ringzle.com/web/assets/images/fm_logo.png'
- );
- });
- });
|