Skip to content

Commit fc9d8fb

Browse files
committed
fix tests & dynamic rewrite for openid-client
1 parent d721f72 commit fc9d8fb

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

test/redhatTelemetry.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ suite('RedhatTelemetry module', async () => {
4949
});
5050

5151
test('should send statup telemetry event', async () => {
52-
await redhatTelemetryRewire.startUp({});
52+
await redhatTelemetryRewire.initTelemetry({});
5353
expect(sendEventMock.sendStartupEvent).to.have.been.calledOnce;
5454
});
5555

test/tokenValidation.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ suite('TokenValidation module', async () => {
2727
test('should validate non-empty Snyk token', async () => {
2828
globalConfig.telemetryId = 'mockId';
2929
const options = {
30-
'RHDA_TOKEN': 'mockId',
30+
'RHDA_TOKEN': '',
31+
'RHDA_TELEMETRY_ID': 'mockId',
3132
'RHDA_SOURCE': 'vscode',
3233
'EXHORT_SNYK_TOKEN': 'mockToken'
3334
};
@@ -36,7 +37,8 @@ suite('TokenValidation module', async () => {
3637

3738
await validateSnykToken(new MockTokenProvider(), 'mockToken');
3839

39-
expect(exhortServicesStub.calledOnceWithExactly(options, 'Snyk')).to.be.true;
40+
expect(exhortServicesStub.getCall(0).args[0]).to.eql(options);
41+
expect(exhortServicesStub.getCall(0).args[1]).to.equal('Snyk');
4042
});
4143

4244
test('should validate empty Snyk token', async () => {

transformToDynamicImport.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
find out/ | grep -E 'js$' | xargs -I {} sed -i.bak 's|require("@trustification/exhort-javascript-api")|import("@trustification/exhort-javascript-api")|g' {} && find out/ -name "*.bak" -delete
1+
find out/ | grep -E 'js$' | xargs -I {} sed -i.bak 's|require("@trustification/exhort-javascript-api")|import("@trustification/exhort-javascript-api")|g' {} && find out/ -name "*.bak" -delete
2+
find out/ | grep -E 'js$' | xargs -I {} sed -i.bak 's|require("openid-client")|import("openid-client")|g' {} && find out/ -name "*.bak" -delete

0 commit comments

Comments
 (0)