@@ -3,6 +3,8 @@ const live = require('../../../../lib/commands/implementations/live');
3
3
const CommandOutput = require ( '../../../../lib/commands/command-output' ) ;
4
4
const assert = require ( 'assert' ) ;
5
5
const streamInfoOffline = require ( './mocks/stream-info-offline.json' ) ;
6
+ const streamInfoOfflineNull = require ( './mocks/stream-info-offline-null.json' ) ;
7
+ const streamInfoOnline = require ( './mocks/stream-info-online.json' ) ;
6
8
7
9
describe ( '!live Test' , ( ) => {
8
10
const buildMockServices = ( dggApiResponse ) => {
@@ -18,10 +20,24 @@ describe('!live Test', () => {
18
20
it ( 'responds correctly when stream is offline' , function ( ) {
19
21
const expected = new CommandOutput (
20
22
null ,
21
- `Stream was last online 2 days 11h ago. Time Streamed: 4h 34m .` ,
23
+ `Stream was last online 2 days 11h ago. Time Streamed: 4h 35m .` ,
22
24
) ;
23
25
return live . work ( null , buildMockServices ( streamInfoOffline ) ) . then ( ( response ) => {
24
26
assert . deepStrictEqual ( response , expected ) ;
25
27
} ) ;
26
28
} ) ;
29
+
30
+ it ( 'responds correctly when all streams are null' , function ( ) {
31
+ const expected = new CommandOutput ( null , 'Stream is offline.' ) ;
32
+ return live . work ( null , buildMockServices ( streamInfoOfflineNull ) ) . then ( ( response ) => {
33
+ assert . deepStrictEqual ( response , expected ) ;
34
+ } ) ;
35
+ } ) ;
36
+
37
+ it ( 'responds with start time of oldest stream and cumulative viewers' , function ( ) {
38
+ const expected = new CommandOutput ( null , `Viewers: 17018. Stream live as of 2 days 16h ago.` ) ;
39
+ return live . work ( null , buildMockServices ( streamInfoOnline ) ) . then ( ( response ) => {
40
+ assert . deepStrictEqual ( response , expected ) ;
41
+ } ) ;
42
+ } ) ;
27
43
} ) ;
0 commit comments