forked from jshttp/basic-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformat.bench.ts
More file actions
27 lines (23 loc) · 770 Bytes
/
format.bench.ts
File metadata and controls
27 lines (23 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { bench, describe } from 'vitest';
import { format } from './index';
describe('format', () => {
bench('format with simple credentials', () => {
const credentials = { name: 'user', pass: 'password' };
format(credentials);
});
bench('format with long credentials', () => {
const credentials = {
name: 'verylongusernameforbasicauth',
pass: 'verylongpasswordwithmanycharactersforbenchmark',
};
format(credentials);
});
bench('format with unicode credentials', () => {
const credentials = { name: 'jürgen', pass: 'pässwörd' };
format(credentials);
});
bench('format with special characters', () => {
const credentials = { name: 'user@domain', pass: 'p@ss!word#123' };
format(credentials);
});
});