diff --git a/test/decompress.test.js b/test/decompress.test.js index 4f57c2f..7faf977 100644 --- a/test/decompress.test.js +++ b/test/decompress.test.js @@ -1,3 +1,4 @@ +import fs from 'fs' import { describe, expect, it } from 'vitest' import { snappyUncompress } from '../hysnappy.js' @@ -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') diff --git a/test/files/hysnappy.jpg.snappy b/test/files/hysnappy.jpg.snappy new file mode 100644 index 0000000..388f5bd Binary files /dev/null and b/test/files/hysnappy.jpg.snappy differ