@@ -17,33 +17,45 @@ describe('Subscribe Command-Line Interface', () => {
1717 const argv = commandProcessor . parse ( root , [ 'subscribe' ] ) ;
1818 expect ( argv . clierror ) . to . equal ( undefined ) ;
1919 expect ( argv . params ) . to . eql ( { event : undefined } ) ;
20- expect ( argv . all ) . to . equal ( false ) ;
2120 expect ( argv . device ) . to . equal ( undefined ) ;
2221 expect ( argv . until ) . to . equal ( undefined ) ;
2322 expect ( argv . max ) . to . equal ( undefined ) ;
23+ expect ( argv . product ) . to . equal ( undefined ) ;
24+ expect ( argv . org ) . to . equal ( undefined ) ;
2425 } ) ;
2526
2627 it ( 'Parses optional params' , ( ) => {
2728 const argv = commandProcessor . parse ( root , [ 'subscribe' , 'test' ] ) ;
2829 expect ( argv . clierror ) . to . equal ( undefined ) ;
2930 expect ( argv . params ) . to . eql ( { event : 'test' } ) ;
30- expect ( argv . all ) . to . equal ( false ) ;
3131 expect ( argv . device ) . to . equal ( undefined ) ;
3232 expect ( argv . until ) . to . equal ( undefined ) ;
3333 expect ( argv . max ) . to . equal ( undefined ) ;
3434 } ) ;
3535
3636 it ( 'Parses options' , ( ) => {
37- const args = [ 'subscribe' , 'test' , '--all' , '-- device', 'my-device' , '--until' , 'my-data' , '--max' , '3' ] ;
37+ const args = [ 'subscribe' , 'test' , '--device' , 'my-device' , '--until' , 'my-data' , '--max' , '3' ] ;
3838 const argv = commandProcessor . parse ( root , args ) ;
3939 expect ( argv . clierror ) . to . equal ( undefined ) ;
4040 expect ( argv . params ) . to . eql ( { event : 'test' } ) ;
41- expect ( argv . all ) . to . equal ( true ) ;
4241 expect ( argv . device ) . to . equal ( 'my-device' ) ;
4342 expect ( argv . until ) . to . equal ( 'my-data' ) ;
4443 expect ( argv . max ) . to . equal ( 3 ) ;
4544 } ) ;
4645
46+ it ( 'Parses `--org`' , ( ) => {
47+ const argv = commandProcessor . parse ( root , [ 'subscribe' , 'test' , '--org' , 'my-org' ] ) ;
48+ expect ( argv . clierror ) . to . equal ( undefined ) ;
49+ expect ( argv . params ) . to . eql ( { event : 'test' } ) ;
50+ expect ( argv . org ) . to . equal ( 'my-org' ) ;
51+ } ) ;
52+
53+ it ( 'Rejects the removed `--all` flag as an unknown argument' , ( ) => {
54+ const argv = commandProcessor . parse ( root , [ 'subscribe' , 'test' , '--all' ] ) ;
55+ expect ( argv . clierror ) . to . be . an . instanceof ( Error ) ;
56+ expect ( argv . clierror . message ) . to . include ( 'all' ) ;
57+ } ) ;
58+
4759 it ( 'Includes help with examples' , ( ) => {
4860 const termWidth = null ; // don't right-align option type labels so testing is easier
4961 commandProcessor . parse ( root , [ 'subscribe' , '--help' ] , termWidth ) ;
@@ -53,18 +65,18 @@ describe('Subscribe Command-Line Interface', () => {
5365 'Usage: particle subscribe [options] [event]' ,
5466 '' ,
5567 'Options:' ,
56- ' --all Listen to all events instead of just those from my devices [boolean]' ,
5768 ' --device Listen to events from this device only [string]' ,
5869 ' --until Listen until we see an event exactly matching this data [string]' ,
5970 ' --max Listen until we see this many events [number]' ,
6071 ' --product Target a device within the given Product ID or Slug [string]' ,
72+ ' --org Specify the organization slug (e.g. my-org) [string]' ,
6173 '' ,
6274 'Examples:' ,
6375 ' particle subscribe Subscribe to all event published by my devices' ,
6476 ' particle subscribe update Subscribe to events starting with `update` from my devices' ,
6577 ' particle subscribe --product 12345 Subscribe to all events published by devices within product `12345`' ,
78+ ' particle subscribe --org my-org Subscribe to all events published by devices within organization `my-org`' ,
6679 ' particle subscribe --device blue Subscribe to all events published by device `blue`' ,
67- ' particle subscribe --all Subscribe to public events and all events published by my devices' ,
6880 ' particle subscribe --until data Subscribe to all events and exit when an event has data matching `data`' ,
6981 ' particle subscribe --max 4 Subscribe to all events and exit after seeing `4` events' ,
7082 ''
0 commit comments