Expose reportLifeCycle to plugins for reporting

Change-Id: I07cd0f89b92cbfda21dd381cdee9ca43ed651b5f
This commit is contained in:
Tao Zhou
2020-09-16 11:26:39 +02:00
parent c5a486c2d5
commit b5150cbdda
2 changed files with 21 additions and 0 deletions

View File

@@ -37,4 +37,11 @@ export class GrReporintJsApi {
details
);
}
reportLifeCycle(eventName: string, details?: EventDetails) {
return this.reporting.reportLifeCycle(
`${this.plugin.getPluginName()}-${eventName}`,
details
);
}
}

View File

@@ -57,5 +57,19 @@ suite('gr-reporting-js-api tests', () => {
{}
);
});
test('redirect reportLifeCycle call to reportingService', () => {
sinon.spy(appContext.reportingService, 'reportLifeCycle');
reporting.reportLifeCycle('test', {});
assert.isTrue(appContext.reportingService.reportLifeCycle.called);
assert.equal(
appContext.reportingService.reportLifeCycle.lastCall.args[0],
'testplugin-test'
);
assert.deepEqual(
appContext.reportingService.reportLifeCycle.lastCall.args[1],
{}
);
});
});
});