aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/internal/base64.spec.ts18
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'));
+ }
+ );
+});