File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ var axios = require ( 'axios' ) ;
4+
35/**
46 * Gets the current battles
5- * @param {string } mode
67 * @return {object }
78 */
8- module . exports . getCurrentStages = function ( mode ) {
9+ module . exports . getCurrentStages = function ( ) {
10+ var leagueDataMode ;
11+ var leagueDataStageA ;
12+ var leagueDataStageB ;
13+ var leagueDataStart ;
14+ var leagueDataEnd ;
15+ axios . get ( 'https://splatoon2.ink/data/schedules.json' )
16+ . then ( function ( res ) {
17+ var leagueDataMode = res . data . league [ 0 ] . rule . name ;
18+ var leagueDataStageA = res . data . league [ 0 ] . stage_a . name ;
19+ var leagueDataStageB = res . data . league [ 0 ] . stage_b . name ;
20+ var leagueDataStart = res . data . league [ 0 ] . start_time ;
21+ var leagueDataEnd = res . data . league [ 0 ] . end_time ;
22+ } )
23+ . catch ( function ( error ) {
24+ console . log ( error ) ;
25+ } ) ;
26+
927 var data = {
10- apiVersion : "0.1.1"
28+ apiVersion : "0.1.1" ,
29+ league : {
30+ mode : leagueDataMode ,
31+ stageA : leagueDataStageA ,
32+ stageB : leagueDataStageB ,
33+ start : leagueDataStart ,
34+ end : leagueDataEnd
35+ }
1136 } ;
1237 return data ;
1338} ;
Original file line number Diff line number Diff line change 33var expect = require ( 'chai' ) . expect ;
44var client = require ( '../index' ) ;
55
6- describe ( '#numFormatter ' , function ( ) {
6+ describe ( '#api ' , function ( ) {
77 it ( 'should give API version' , function ( ) {
88 var data = client . getCurrentStages ( ) ;
99 expect ( data . apiVersion ) . to . equal ( '0.1.1' ) ;
You can’t perform that action at this time.
0 commit comments