From ecad1e2e9d8c479a0f1a525a9b6f99383d6413fe Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Fri, 22 May 2020 14:59:40 -0700 Subject: Stop stripping base64 padding in browser --- packages/browser/src/helpers/toBase64String.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 packages/browser/src/helpers/toBase64String.test.ts (limited to 'packages/browser/src/helpers/toBase64String.test.ts') diff --git a/packages/browser/src/helpers/toBase64String.test.ts b/packages/browser/src/helpers/toBase64String.test.ts new file mode 100644 index 0000000..c16ec72 --- /dev/null +++ b/packages/browser/src/helpers/toBase64String.test.ts @@ -0,0 +1,15 @@ +import toBase64String from './toBase64String'; + +import toUintArray from './toUint8Array'; + +test('should convert a Buffer to a string with a length that is a multiple of 4', () => { + const base64 = toBase64String(Buffer.from('123456', 'ascii')); + + expect(base64.length % 4).toEqual(0); +}); + +test('should convert a Uint8Array to a string with a length that is a multiple of 4', () => { + const base64 = toBase64String(toUintArray('123456')); + + expect(base64.length % 4).toEqual(0); +}); -- cgit v1.2.3