This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
2022-01-01 13:24:06 +00:00
|
|
|
import {it, expect} from 'vitest'
|
|
|
|
|
2021-07-28 19:56:29 +00:00
|
|
|
import {calculateItemPosition} from './calculateItemPosition'
|
|
|
|
|
|
|
|
it('should calculate the task position', () => {
|
|
|
|
const result = calculateItemPosition(10, 100)
|
|
|
|
expect(result).toBe(55)
|
|
|
|
})
|
|
|
|
it('should return 0 if no position was provided', () => {
|
|
|
|
const result = calculateItemPosition(null, null)
|
|
|
|
expect(result).toBe(0)
|
|
|
|
})
|
|
|
|
it('should calculate the task position for the first task', () => {
|
|
|
|
const result = calculateItemPosition(null, 100)
|
|
|
|
expect(result).toBe(50)
|
|
|
|
})
|
|
|
|
it('should calculate the task position for the last task', () => {
|
|
|
|
const result = calculateItemPosition(10, null)
|
|
|
|
expect(result).toBe(65546)
|
|
|
|
})
|