blob: 1243301ec6da68b4c10177f7bc6f1ae85396e533 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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'));
}
);
});
|