mirror of https://github.com/kern/filepizza
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
568 B
TypeScript
16 lines
568 B
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { isFinalChunk, MAX_CHUNK_SIZE } from '../../src/hooks/useUploaderConnections'
|
|
|
|
describe('isFinalChunk', () => {
|
|
it('marks last chunk when file size is exact multiple of chunk size', () => {
|
|
const fileSize = MAX_CHUNK_SIZE * 2
|
|
// when offset points to start of last chunk
|
|
expect(isFinalChunk(MAX_CHUNK_SIZE, fileSize)).toBe(true)
|
|
})
|
|
|
|
it('returns false for middle chunks', () => {
|
|
const fileSize = MAX_CHUNK_SIZE * 3 + 123
|
|
expect(isFinalChunk(MAX_CHUNK_SIZE, fileSize)).toBe(false)
|
|
})
|
|
})
|