Skip to content

Commit fa79568

Browse files
committed
chore: fix tests
1 parent 7e22687 commit fa79568

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

packages/http-client/src/http-client.spec.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import https from 'https';
22
import http from 'http';
3+
import { createPublicKey } from 'node:crypto';
34
import { HttpsProxyAgent } from 'https-proxy-agent';
45
import nock from 'nock';
56
import { createLogger } from '@sap-cloud-sdk/util';
@@ -13,7 +14,6 @@ import {
1314
} from '@sap-cloud-sdk/resilience/internal';
1415
import { registerDestination } from '@sap-cloud-sdk/connectivity';
1516
import { registerDestinationCache } from '@sap-cloud-sdk/connectivity/internal';
16-
import { responseWithPublicKey } from '@sap-cloud-sdk/connectivity/src/scp-cf/jwt/verify.spec';
1717
import {
1818
basicMultipleResponse,
1919
connectivityProxyConfigMock,
@@ -30,7 +30,8 @@ import {
3030
subscriberServiceToken,
3131
subscriberUserToken,
3232
testTenants,
33-
xsuaaBindingMock
33+
xsuaaBindingMock,
34+
publicKey
3435
} from '../../../test-resources/test/test-util';
3536
import * as csrf from './csrf-token-middleware';
3637
import {
@@ -94,6 +95,21 @@ describe('generic http client', () => {
9495
name: 'FORWARD-TOKEN-NOAUTH'
9596
};
9697

98+
function responseWithPublicKey(key: string = publicKey) {
99+
const pubKey = createPublicKey(key);
100+
const jwk = pubKey.export({ format: 'jwk' });
101+
return {
102+
keys: [
103+
{
104+
use: 'sig',
105+
kid: 'key-id-1',
106+
alg: 'RS256',
107+
...jwk
108+
}
109+
]
110+
};
111+
}
112+
97113
describe('buildHttpRequest', () => {
98114
it('creates an https request', async () => {
99115
const expectedHttps: DestinationHttpRequestConfig = {

0 commit comments

Comments
 (0)