Expose reportLifeCycle
to plugins for reporting
Change-Id: I07cd0f89b92cbfda21dd381cdee9ca43ed651b5f
This commit is contained in:
@@ -37,4 +37,11 @@ export class GrReporintJsApi {
|
||||
details
|
||||
);
|
||||
}
|
||||
|
||||
reportLifeCycle(eventName: string, details?: EventDetails) {
|
||||
return this.reporting.reportLifeCycle(
|
||||
`${this.plugin.getPluginName()}-${eventName}`,
|
||||
details
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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],
|
||||
{}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user