diff options
author | Matthew Miller <matthew@millerti.me> | 2020-05-22 18:22:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-22 18:22:21 -0700 |
commit | d6dc6e5bfc588036db2c1b2212b8f8bc74b1c0f5 (patch) | |
tree | b58d6593de62689f0a13a8ea932e5892aefb29de /packages/browser/src/helpers/toBase64String.test.ts | |
parent | efe856ed238e7a2be8d847c94ba8e0155b17ce9c (diff) | |
parent | 2548e4fd6a5e3d82b2f1b348eec442bd318e4872 (diff) |
Merge pull request #2 from MasterKale/feature/example-site
feature/example-site
Diffstat (limited to 'packages/browser/src/helpers/toBase64String.test.ts')
-rw-r--r-- | packages/browser/src/helpers/toBase64String.test.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/browser/src/helpers/toBase64String.test.ts b/packages/browser/src/helpers/toBase64String.test.ts new file mode 100644 index 0000000..bbcb11b --- /dev/null +++ b/packages/browser/src/helpers/toBase64String.test.ts @@ -0,0 +1,15 @@ +import toBase64String from './toBase64String'; + +import toUint8Array 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(toUint8Array('123456')); + + expect(base64.length % 4).toEqual(0); +}); |