-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresponses.test.ts
25 lines (23 loc) · 1012 Bytes
/
responses.test.ts
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
import { createResponseHeaders } from '@maestro-org/maestro-arch-rpc-node-sdk/core';
import { Headers } from '@maestro-org/maestro-arch-rpc-node-sdk/_shims/index';
describe('response parsing', () => {
// TODO: test unicode characters
test('headers are case agnostic', async () => {
const headers = createResponseHeaders(new Headers({ 'Content-Type': 'foo', Accept: 'text/plain' }));
expect(headers['content-type']).toEqual('foo');
expect(headers['Content-type']).toEqual('foo');
expect(headers['Content-Type']).toEqual('foo');
expect(headers['accept']).toEqual('text/plain');
expect(headers['Accept']).toEqual('text/plain');
expect(headers['Hello-World']).toBeUndefined();
});
test('duplicate headers are concatenated', () => {
const headers = createResponseHeaders(
new Headers([
['Content-Type', 'text/xml'],
['Content-Type', 'application/json'],
]),
);
expect(headers['content-type']).toBe('text/xml, application/json');
});
});