File tree 3 files changed +35
-3
lines changed
3 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -7,5 +7,9 @@ const config = {
7
7
} ;
8
8
9
9
zulip ( config ) . then ( ( z ) => {
10
- z . realm . retrieve ( ) . then ( console . log ) ;
10
+ z . realm . emoji ( ) . then ( console . log ) ;
11
+ } ) . catch ( err => console . log ( err . message ) ) ;
12
+
13
+ zulip ( config ) . then ( ( z ) => {
14
+ z . realm . filters ( ) . then ( console . log ) ;
11
15
} ) . catch ( err => console . log ( err . message ) ) ;
Original file line number Diff line number Diff line change @@ -2,10 +2,14 @@ const api = require('../api');
2
2
3
3
function realm ( config ) {
4
4
return {
5
- retrieve : ( params ) => {
5
+ emoji : ( params ) => {
6
6
const url = `${ config . apiURL } /realm/emoji` ;
7
7
return api ( url , config , 'GET' , params ) ;
8
8
} ,
9
+ filters : ( params ) => {
10
+ const url = `${ config . apiURL } /realm/filters` ;
11
+ return api ( url , config , 'GET' , params ) ;
12
+ } ,
9
13
} ;
10
14
}
11
15
Original file line number Diff line number Diff line change @@ -26,7 +26,31 @@ describe('Realm', () => {
26
26
result : 'success' ,
27
27
} ;
28
28
const stubs = common . getStubs ( validator , output ) ;
29
- realm ( common . config ) . retrieve ( )
29
+ realm ( common . config ) . emoji ( )
30
+ . then ( ( data ) => {
31
+ data . should . have . property ( 'result' , 'success' ) ;
32
+ common . restoreStubs ( stubs ) ;
33
+ done ( ) ;
34
+ } ) . catch ( done ) ;
35
+ } ) ;
36
+
37
+ it ( 'should fetch realm filters' , ( done ) => {
38
+ const validator = ( url , options ) => {
39
+ url . should . equal ( `${ common . config . apiURL } /realm/filters` ) ;
40
+ options . should . not . have . property ( 'body' ) ;
41
+ options . method . should . be . equal ( 'GET' ) ;
42
+ } ;
43
+ const output = {
44
+ filters : [
45
+ [ '#(?P<id>[0-9]{2,8})' ,
46
+ 'https://github.com/zulip/zulip/pull/%(id)s' ,
47
+ 1 ] ,
48
+ ] ,
49
+ msg : '' ,
50
+ result : 'success' ,
51
+ } ;
52
+ const stubs = common . getStubs ( validator , output ) ;
53
+ realm ( common . config ) . filters ( )
30
54
. then ( ( data ) => {
31
55
data . should . have . property ( 'result' , 'success' ) ;
32
56
common . restoreStubs ( stubs ) ;
You can’t perform that action at this time.
0 commit comments