Support even values
This commit is contained in:
parent
dc73e57ba8
commit
2d27587d0c
|
@ -45,7 +45,7 @@ export function getSingleFileMaxSizeInfo(totalMaxSize: string) {
|
|||
return { size: `${size / 2}${unit}`, totalHistoryFiles: 1 }
|
||||
}
|
||||
|
||||
return { size: `1${unit}`, totalHistoryFiles: size }
|
||||
return { size: `1${unit}`, totalHistoryFiles: size - 1 }
|
||||
}
|
||||
|
||||
export function localFileDestination() {
|
||||
|
|
|
@ -19,12 +19,12 @@ describe("system", () => {
|
|||
)
|
||||
|
||||
it.each([
|
||||
["5B", "1B", 5],
|
||||
["17K", "1K", 17],
|
||||
["21M", "1M", 21],
|
||||
["3G", "1G", 3],
|
||||
["5B", "1B", 4],
|
||||
["17K", "1K", 16],
|
||||
["21M", "1M", 20],
|
||||
["3G", "1G", 2],
|
||||
])(
|
||||
"Halving an odd number (%s) returns as many files as size (%s)",
|
||||
"Halving an odd number (%s) returns as many files as size (-1) (%s)",
|
||||
(totalValue, expectedMaxSize, totalHistoryFiles) => {
|
||||
const result = getSingleFileMaxSizeInfo(totalValue)
|
||||
expect(result).toEqual({
|
||||
|
|
Loading…
Reference in New Issue