@storacha/encrypt-upload-client 1.1.76-rc.3 → 1.1.76-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -255,6 +255,16 @@ await describe('File Metadata Utils', async () => {
|
|
|
255
255
|
assert.equal(fileMetadata, undefined);
|
|
256
256
|
assert(fileStream instanceof ReadableStream);
|
|
257
257
|
});
|
|
258
|
+
await it('should preserve content of files smaller than header size', async () => {
|
|
259
|
+
const content = 'small file without metadata';
|
|
260
|
+
const smallBlob = new Blob([content]);
|
|
261
|
+
const stream = smallBlob.stream();
|
|
262
|
+
const { fileStream, fileMetadata } = await extractFileMetadata(stream);
|
|
263
|
+
assert.equal(fileMetadata, undefined);
|
|
264
|
+
const extractedContent = await streamToArrayBuffer(fileStream);
|
|
265
|
+
const originalContent = await smallBlob.arrayBuffer();
|
|
266
|
+
assert.deepEqual(new Uint8Array(extractedContent), new Uint8Array(originalContent));
|
|
267
|
+
});
|
|
258
268
|
await it('should handle malformed JSON in metadata', async () => {
|
|
259
269
|
const header = new Uint8Array(1024);
|
|
260
270
|
const malformedJson = '{name:"test",invalid}';
|