File tree Expand file tree Collapse file tree 4 files changed +61
-60
lines changed
Expand file tree Collapse file tree 4 files changed +61
-60
lines changed Original file line number Diff line number Diff line change 1+ import { throwError } from 'rxjs' ;
2+
3+ import WebexAdapter from './WebexAdapter' ;
4+
5+ /**
6+ * This is a base class that defines the interface that maps activity data.
7+ * Developers that want to extend `ActivitiesAdapter` must implement all of its methods,
8+ * adhering to the exact parameters and structure of the returned objects.
9+ */
10+ export default class ActivitiesAdapter extends WebexAdapter {
11+ /**
12+ * An activity a person performs in Webex.
13+ *
14+ * @typedef {Object } Activity
15+ * @property {string } ID The activity identifier.
16+ * @property {string } roomID ID of the room where the activity happens.
17+ * @property {string } text Any text the activity may contain.
18+ * @property {string } personID ID of the person performing the activity.
19+ * @property {Date } created Timestamp of the time when the activity happened.
20+ * @property {Boolean } displayAuthor Whether to display author information or not.
21+ */
22+
23+ /**
24+ * Returns an observable that emits activity data of the given ID.
25+ *
26+ * @param {string } ID ID of the activity to get.
27+ * @returns {Observable.<Activity> }
28+ * @memberof ActivityAdapter
29+ */
30+ // eslint-disable-next-line no-unused-vars
31+ getActivity ( ID ) {
32+ return throwError ( new Error ( 'getActivity(ID) must be defined in ActivitiesAdapter' ) ) ;
33+ }
34+ }
Original file line number Diff line number Diff line change 1+ import ActivitiesAdapter from './ActivitiesAdapter' ;
2+
3+ describe ( 'Activities Adapter Interface' , ( ) => {
4+ let activitiesAdapter ;
5+
6+ beforeEach ( ( ) => {
7+ activitiesAdapter = new ActivitiesAdapter ( ) ;
8+ } ) ;
9+
10+ test ( 'getActivity() returns an observable' , ( ) => {
11+ expect ( rxjs . isObservable ( activitiesAdapter . getActivity ( ) ) ) . toBeTruthy ( ) ;
12+ } ) ;
13+
14+ test ( 'getActivity() throws a proper error message' , ( done ) => {
15+ activitiesAdapter . getActivity ( 'msgID' ) . subscribe (
16+ ( ) => { } ,
17+ ( error ) => {
18+ expect ( error . message ) . toBe ( 'getActivity(ID) must be defined in ActivitiesAdapter' ) ;
19+ done ( ) ;
20+ }
21+ ) ;
22+ } ) ;
23+
24+ afterEach ( ( ) => {
25+ activitiesAdapter = null ;
26+ } ) ;
27+ } ) ;
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments