diff options
| author | ST-DDT <[email protected]> | 2024-09-26 18:00:14 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-09-26 16:00:14 +0000 |
| commit | 78b2a3a8b85679eeff27beccebcc404b0a5ff3cf (patch) | |
| tree | 50012521180747094a55a862dfe7a0ba164feef4 /test/internal | |
| parent | d6bceb662de6559446fedb11de53a632a525aba0 (diff) | |
| download | faker-78b2a3a8b85679eeff27beccebcc404b0a5ff3cf.tar.xz faker-78b2a3a8b85679eeff27beccebcc404b0a5ff3cf.zip | |
fix(image): fix dataUri with type svg-base64 in browsers (#3144)
Diffstat (limited to 'test/internal')
| -rw-r--r-- | test/internal/base64.spec.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/internal/base64.spec.ts b/test/internal/base64.spec.ts new file mode 100644 index 00000000..1243301e --- /dev/null +++ b/test/internal/base64.spec.ts @@ -0,0 +1,18 @@ +import { describe, expect, it } from 'vitest'; +import { faker } from '../../src'; +import { toBase64 } from '../../src/internal/base64'; + +// This test is kind of useless, because during testing the Buffer object is always available. +describe('toBase64', () => { + it.each( + faker.helpers.multiple( + () => faker.string.alphanumeric({ length: { min: 0, max: 100 } }), + { count: 5 } + ) + )( + "should behave the same as `Buffer.from(value).toString('base64')`", + (value) => { + expect(toBase64(value)).toBe(Buffer.from(value).toString('base64')); + } + ); +}); |
