Skip to content

Commit 89a3874

Browse files
committed
test: verify saveBase64 content instead of on-disk size
With encryption enabled, saveBase64 goes through the regular save path and the stored file is larger than the payload on Android, so asserting on getFileSize failed. Read the file back with readAsDataURL instead.
1 parent abb657c commit 89a3874

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎example/__tests__/file-system.harness.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,11 @@ describe('NativeFileSystem', () => {
313313
const base64 = btoa(String.fromCharCode(1, 2, 3, 4));
314314
await NativeFileSystem.saveBase64(base64, filePath);
315315

316-
const size = await NativeFileSystem.getFileSize(filePath);
317-
expect(size).toBe(4);
316+
// Not asserting on getFileSize: saveBase64 goes through the regular save
317+
// path, so with encryption enabled the on-disk size includes overhead.
318+
// readAsDataURL decrypts, so it verifies the stored content.
319+
const dataUrl = await NativeFileSystem.readAsDataURL(filePath);
320+
expect(dataUrl).contains(base64);
318321

319322
await NativeFileSystem.remove(filePath);
320323
});

0 commit comments

Comments
 (0)