Snappy jpg test

This commit is contained in:
Kenny Daniel 2024-04-12 23:58:37 -07:00
parent 00cbb6a3e6
commit d0213bf0f1
No known key found for this signature in database
GPG Key ID: 90AB653A8CAD7E45
2 changed files with 9 additions and 0 deletions

Binary file not shown.

@ -1,3 +1,4 @@
import fs from 'fs'
import { describe, expect, it } from 'vitest'
import { snappyUncompress } from '../src/snappy.js'
@ -50,6 +51,14 @@ describe('snappy uncompress', () => {
await Promise.all(futures)
})
it('decompress hyparquet.jpg.snappy', async () => {
const compressed = fs.readFileSync('test/files/hyparquet.jpg.snappy')
const expected = fs.readFileSync('hyparquet.jpg')
const output = new Uint8Array(expected.length)
await snappyUncompress(compressed, output)
expect(Array.from(output)).toEqual(Array.from(expected))
})
it('throws for invalid input', () => {
const output = new Uint8Array(10)
expect(() => snappyUncompress(new Uint8Array([]), output))