Migrate more to Jotai (#17968)
As per title --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
import { canOpenObjectInSidePanel } from '@/object-record/utils/canOpenObjectInSidePanel';
|
||||
|
||||
describe('canOpenObjectInSidePanel', () => {
|
||||
it('should return false for workflow objects', () => {
|
||||
expect(canOpenObjectInSidePanel('workflow')).toBe(false);
|
||||
expect(canOpenObjectInSidePanel('workflowVersion')).toBe(false);
|
||||
expect(canOpenObjectInSidePanel('dashboard')).toBe(false);
|
||||
});
|
||||
|
||||
it('should return true for other objects', () => {
|
||||
expect(canOpenObjectInSidePanel('person')).toBe(true);
|
||||
expect(canOpenObjectInSidePanel('company')).toBe(true);
|
||||
expect(canOpenObjectInSidePanel('task')).toBe(true);
|
||||
});
|
||||
});
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
import { computeNewEvenlySpacedPositions } from '@/object-record/utils/computeNewEvenlySpacedPositions';
|
||||
|
||||
describe('computeNewEvenlySpacedPositions', () => {
|
||||
it('should compute evenly spaced positions between two values', () => {
|
||||
const result = computeNewEvenlySpacedPositions({
|
||||
startingPosition: 0,
|
||||
endingPosition: 10,
|
||||
numberOfRecordsToInsertBetween: 4,
|
||||
});
|
||||
|
||||
expect(result).toEqual([2, 4, 6, 8]);
|
||||
});
|
||||
|
||||
it('should return a single midpoint when inserting one record', () => {
|
||||
const result = computeNewEvenlySpacedPositions({
|
||||
startingPosition: 0,
|
||||
endingPosition: 10,
|
||||
numberOfRecordsToInsertBetween: 1,
|
||||
});
|
||||
|
||||
expect(result).toEqual([5]);
|
||||
});
|
||||
|
||||
it('should return all same values when gap is zero', () => {
|
||||
const result = computeNewEvenlySpacedPositions({
|
||||
startingPosition: 5,
|
||||
endingPosition: 5,
|
||||
numberOfRecordsToInsertBetween: 3,
|
||||
});
|
||||
|
||||
expect(result).toEqual([5, 5, 5]);
|
||||
});
|
||||
|
||||
it('should throw when starting position is after ending position', () => {
|
||||
expect(() =>
|
||||
computeNewEvenlySpacedPositions({
|
||||
startingPosition: 10,
|
||||
endingPosition: 5,
|
||||
numberOfRecordsToInsertBetween: 1,
|
||||
}),
|
||||
).toThrow();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user