diff --git a/src/common/utils/shapes/shape-restrictions.spec.ts b/src/common/utils/shapes/shape-restrictions.spec.ts index ebdd5f50..ed4d2da9 100644 --- a/src/common/utils/shapes/shape-restrictions.spec.ts +++ b/src/common/utils/shapes/shape-restrictions.spec.ts @@ -1,5 +1,5 @@ -import { fitSizeToShapeSizeRestrictions } from './shape-restrictions'; -import { ShapeSizeRestrictions } from './shape-restrictions'; +import { fitSizeToShapeSizeRestrictions } from '@/common/utils/shapes/shape-restrictions'; +import { ShapeSizeRestrictions } from '@/common/utils/shapes/shape-restrictions'; //Mock data const restrictions: ShapeSizeRestrictions = { @@ -10,14 +10,6 @@ const restrictions: ShapeSizeRestrictions = { defaultWidth: 100, defaultHeight: 100, }; -const restrictions2: ShapeSizeRestrictions = { - minWidth: 50, - minHeight: 30, - maxWidth: -1, - maxHeight: -1, - defaultWidth: 100, - defaultHeight: 100, -}; describe('./pods/canvas/canvas.util', () => { it('should set width to minimum width if width is 0', () => { @@ -119,14 +111,45 @@ describe('./pods/canvas/canvas.util', () => { //Assert expect(result).toEqual({ width: 50, height: 30 }); }); - it('should return width and height as is when maxWidth and maxHeight are -1', () => { + it('should return width and height as is when all bounds are -1', () => { // Arrange const width = 400; const height = 250; + const restrictions2: ShapeSizeRestrictions = { + minWidth: -1, + minHeight: -1, + maxWidth: -1, + maxHeight: -1, + defaultWidth: 100, + defaultHeight: 100, + }; // Act const result = fitSizeToShapeSizeRestrictions(restrictions2, width, height); + //Assert + expect(result).toEqual({ width: 400, height: 250 }); + }); + it('should return width and height as is when maxWidth and maxHeight are -1', () => { + // Arrange + const width = 400; + const height = 250; + const defaultShapeSizeRestrictions: ShapeSizeRestrictions = { + minWidth: 0, + minHeight: 0, + maxWidth: -1, + maxHeight: -1, + defaultWidth: 100, + defaultHeight: 100, + }; + + // Act + const result = fitSizeToShapeSizeRestrictions( + defaultShapeSizeRestrictions, + width, + height + ); + //Assert expect(result).toEqual({ width: 400, height: 250 }); });