Skip to content

Commit

Permalink
Snappy jpg test
Browse files Browse the repository at this point in the history
  • Loading branch information
platypii committed Apr 15, 2024
1 parent 24dfffd commit d3846e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/decompress.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fs from 'fs'
import { describe, expect, it } from 'vitest'
import { snappyUncompress } from '../hysnappy.js'

Expand Down Expand Up @@ -50,6 +51,13 @@ describe('snappy uncompress', () => {
})
})

it('decompress test jpg', () => {
const compressed = fs.readFileSync('test/files/hysnappy.jpg.snappy')
const expected = fs.readFileSync('hysnappy.jpg')
const output = snappyUncompress(compressed, expected.length)
expect(Array.from(output)).toEqual(Array.from(expected))
})

it('throws for invalid input', () => {
expect(() => snappyUncompress(new Uint8Array([]), 10))
.toThrow('invalid snappy length header')
Expand Down
Binary file added test/files/hysnappy.jpg.snappy
Binary file not shown.

0 comments on commit d3846e2

Please sign in to comment.