Skip to content

Commit 15ab24b

Browse files
committed
add unit test for new lib
1 parent cb40fa3 commit 15ab24b

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { Legacy } from 'kibana';
8+
import { makeRequestFacade } from './make_request_facade';
9+
10+
test('makeRequestFacade', () => {
11+
const originalRequest = ({
12+
getBasePath: () => 'basebase',
13+
params: {
14+
param1: 123,
15+
},
16+
payload: {
17+
payload1: 123,
18+
},
19+
headers: {
20+
user: 123,
21+
},
22+
} as unknown) as Legacy.Request;
23+
24+
expect(makeRequestFacade(originalRequest)).toMatchInlineSnapshot(`
25+
Object {
26+
"getBasePath": [Function],
27+
"getSavedObjectsClient": undefined,
28+
"headers": Object {
29+
"user": 123,
30+
},
31+
"params": Object {
32+
"param1": 123,
33+
},
34+
"payload": Object {
35+
"payload1": 123,
36+
},
37+
"pre": undefined,
38+
"query": undefined,
39+
"route": undefined,
40+
}
41+
`);
42+
});

0 commit comments

Comments
 (0)