mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-30 01:59:23 +00:00
test(ui): unit tests added for profilerUtils (#5922)
This commit is contained in:
parent
8521c45dee
commit
c782d82ae3
@ -0,0 +1,50 @@
|
||||
import {
|
||||
getImageWithResolutionAndFallback,
|
||||
getRoundedValue,
|
||||
ImageQuality,
|
||||
} from './ProfilerUtils';
|
||||
|
||||
const mockImageList = {
|
||||
image: 'image',
|
||||
image192: 'image192',
|
||||
image24: 'image24',
|
||||
image32: 'image32',
|
||||
image48: 'image48',
|
||||
image512: 'image512',
|
||||
image72: 'image72',
|
||||
};
|
||||
|
||||
const mockImageListWithLowQuality = {
|
||||
image: 'image',
|
||||
};
|
||||
|
||||
describe('Test ProfilerUtils', () => {
|
||||
it('getImageWithResolutionAndFallback should return Image with specified quality if present', () => {
|
||||
expect(
|
||||
getImageWithResolutionAndFallback(ImageQuality['6x'], mockImageList)
|
||||
).toEqual(mockImageList.image512);
|
||||
});
|
||||
|
||||
it('getImageWithResolutionAndFallback should return lower quality if asked quality is not present', () => {
|
||||
expect(
|
||||
getImageWithResolutionAndFallback(
|
||||
ImageQuality['5x'],
|
||||
mockImageListWithLowQuality
|
||||
)
|
||||
).toEqual(mockImageList.image);
|
||||
expect(
|
||||
getImageWithResolutionAndFallback(
|
||||
ImageQuality['5x'],
|
||||
mockImageListWithLowQuality
|
||||
)
|
||||
).not.toEqual(mockImageList.image512);
|
||||
});
|
||||
|
||||
it('getRoundedValue should return integer value as it is', () => {
|
||||
expect(getRoundedValue(12)).toEqual(12);
|
||||
});
|
||||
|
||||
it('getRoundedValue should other values as it is', () => {
|
||||
expect(getRoundedValue(false)).toEqual(false);
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user