forked from Lilly-Protocol/lily-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader-init.test.ts
More file actions
37 lines (34 loc) · 1.11 KB
/
Copy pathheader-init.test.ts
File metadata and controls
37 lines (34 loc) · 1.11 KB
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
28
29
30
31
32
33
34
35
36
37
import { describe, it, expect } from 'vitest';
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
/**
* Bounty #65 — $25
* "Accept `HeadersInit` for `HttpRequest.headers`"
*
* Verifies that the HttpRequest type supports HeadersInit
* (Record<string, string> | Headers | [string, string][]).
*/
describe('HttpRequest.headers accepts HeadersInit', () => {
it('HttpRequest type is defined in http/types.ts', () => {
const content = readFileSync(
resolve(process.cwd(), 'src/http/types.ts'),
'utf8',
);
expect(content).toContain('HttpRequest');
});
it('HttpRequest.headers type is compatible with HeadersInit', () => {
const content = readFileSync(
resolve(process.cwd(), 'src/http/types.ts'),
'utf8',
);
// HeadersInit = Record<string, string> | Headers | [string, string][]
expect(content).toContain('Record<string, string>');
});
it('HttpHeaders type is exported', () => {
const content = readFileSync(
resolve(process.cwd(), 'src/http/types.ts'),
'utf8',
);
expect(content).toContain('HttpHeaders');
});
});