feat/e2e-testing (#31)
All checks were successful
🚀 Release / release (push) Successful in 4m7s
All checks were successful
🚀 Release / release (push) Successful in 4m7s
Reviewed-on: #31 Co-authored-by: Max Richter <max@max-richter.dev> Co-committed-by: Max Richter <max@max-richter.dev>
This commit was merged in pull request #31.
This commit is contained in:
55
packages/ui/src/lib/helpers/getBoundingValue.test.ts
Normal file
55
packages/ui/src/lib/helpers/getBoundingValue.test.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { getBoundingValue } from './getBoundingValue';
|
||||
|
||||
describe('getBoundingValue', () => {
|
||||
it('should return 1 for values between 0 and 1', () => {
|
||||
expect(getBoundingValue(0)).toBe(1);
|
||||
expect(getBoundingValue(0.5)).toBe(1);
|
||||
expect(getBoundingValue(1)).toBe(1);
|
||||
});
|
||||
|
||||
it('should return 2 for values between 1 and 2', () => {
|
||||
expect(getBoundingValue(1.1)).toBe(2);
|
||||
expect(getBoundingValue(1.5)).toBe(2);
|
||||
expect(getBoundingValue(2)).toBe(2);
|
||||
});
|
||||
|
||||
it('should return 4 for values between 2 and 4', () => {
|
||||
expect(getBoundingValue(2.1)).toBe(4);
|
||||
expect(getBoundingValue(3)).toBe(4);
|
||||
expect(getBoundingValue(4)).toBe(4);
|
||||
});
|
||||
|
||||
it('should return positive level for positive input', () => {
|
||||
expect(getBoundingValue(5)).toBe(10);
|
||||
expect(getBoundingValue(15)).toBe(20);
|
||||
expect(getBoundingValue(50)).toBe(50);
|
||||
expect(getBoundingValue(150)).toBe(200);
|
||||
});
|
||||
|
||||
it('should return negative level for negative input', () => {
|
||||
expect(getBoundingValue(-5)).toBe(-10);
|
||||
expect(getBoundingValue(-15)).toBe(-20);
|
||||
expect(getBoundingValue(-50)).toBe(-50);
|
||||
expect(getBoundingValue(-150)).toBe(-200);
|
||||
});
|
||||
|
||||
it('should return correct level for boundary values', () => {
|
||||
expect(getBoundingValue(10)).toBe(10);
|
||||
expect(getBoundingValue(20)).toBe(20);
|
||||
expect(getBoundingValue(50)).toBe(50);
|
||||
expect(getBoundingValue(100)).toBe(100);
|
||||
expect(getBoundingValue(200)).toBe(200);
|
||||
});
|
||||
|
||||
it('should handle large values', () => {
|
||||
expect(getBoundingValue(1000)).toBe(1000);
|
||||
expect(getBoundingValue(1500)).toBe(1000);
|
||||
expect(getBoundingValue(-1000)).toBe(-1000);
|
||||
});
|
||||
|
||||
it('should handle very small values', () => {
|
||||
expect(getBoundingValue(0.001)).toBe(1);
|
||||
expect(getBoundingValue(-0.001)).toBe(-1);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user