Skip to content

Commit 5b128d6

Browse files
committed
add test
1 parent 3738c01 commit 5b128d6

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

test/execution_context.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ describe('executionContextMiddleware', () => {
1919
const testSpanId = '123';
2020
const testTrace = 'testtrace';
2121
const validExecutionId = 'xn1h9xdgv6zw';
22-
const headers = {
23-
'X-Cloud-Trace-Context': `${testTrace}/${testSpanId};o=1`,
24-
'function-execution-id': validExecutionId,
25-
};
2622

2723
it('uses execution ID in header', () => {
28-
const req = createRequest({}, headers);
24+
const req = createRequest(
25+
{},
26+
{
27+
'X-Cloud-Trace-Context': `${testTrace}/${testSpanId};o=1`,
28+
'function-execution-id': validExecutionId,
29+
}
30+
);
2931

3032
executionContextMiddleware(req as Request, {} as Response, next);
3133

@@ -34,7 +36,10 @@ describe('executionContextMiddleware', () => {
3436
});
3537

3638
it('generates execution ID if not in header', () => {
37-
const req = createRequest({}, headers);
39+
const req = createRequest(
40+
{},
41+
{'X-Cloud-Trace-Context': `${testTrace}/${testSpanId}`}
42+
);
3843

3944
executionContextMiddleware(req as Request, {} as Response, next);
4045

0 commit comments

Comments
 (0)