-
-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathparse.bench.ts
More file actions
24 lines (20 loc) · 710 Bytes
/
parse.bench.ts
File metadata and controls
24 lines (20 loc) · 710 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
import { describe, bench } from 'vitest';
import { parse } from './index';
describe('parse', () => {
bench('basic auth header', () => {
const header = 'Basic dGVzdDpwYXNzd29yZA=='; // "test:password" in base64
parse(header);
});
bench('basic auth header with extra whitespace', () => {
const header = ' Basic dGVzdDpwYXNzd29yZA== '; // "test:password" in base64 with extra whitespace
parse(header);
});
bench('invalid basic auth header', () => {
const header = 'Basic invalidbase64'; // Invalid base64 string
parse(header);
});
bench('non-basic auth header', () => {
const header = 'Bearer sometoken'; // Not a basic auth header
parse(header);
});
});