From d2944d048d36ea7ab77d4c624b40c4b57d992772 Mon Sep 17 00:00:00 2001 From: Scott Weaver Date: Tue, 20 Jun 2023 19:15:17 -0500 Subject: [PATCH 1/3] test fixes, tnns --- app/app.js | 1 + app/services/cfb.service.js | 119 +-- app/services/mbb.service.js | 138 +-- app/services/mlb.service.js | 37 +- app/services/nba.service.js | 39 +- app/services/ncaa.service.js | 31 +- app/services/nfl.service.js | 26 +- app/services/nhl.service.js | 25 +- app/services/tnns.service.js | 35 + app/services/wbb.service.js | 69 +- app/services/wnba.service.js | 25 +- docs/docs/tnns.md | 27 + package-lock.json | 57 +- package.json | 6 +- rankings.json | 1 + test/cfb.test.js | 241 ++++++ test/mbb.test.js | 239 ++++++ test/mlb.test.js | 157 ++++ test/nba.test.js | 151 ++++ test/ncaa.test.js | 60 ++ test/nfl.test.js | 156 ++++ test/nhl.test.js | 152 ++++ test/test.js | 1566 ---------------------------------- test/tnns.test.js | 54 ++ test/wbb.test.js | 182 ++++ test/wnba.test.js | 144 ++++ 26 files changed, 1928 insertions(+), 1810 deletions(-) create mode 100644 app/services/tnns.service.js create mode 100644 docs/docs/tnns.md create mode 100644 rankings.json create mode 100644 test/cfb.test.js create mode 100644 test/mbb.test.js create mode 100644 test/mlb.test.js create mode 100644 test/nba.test.js create mode 100644 test/ncaa.test.js create mode 100644 test/nfl.test.js create mode 100644 test/nhl.test.js delete mode 100644 test/test.js create mode 100644 test/tnns.test.js create mode 100644 test/wbb.test.js create mode 100644 test/wnba.test.js diff --git a/app/app.js b/app/app.js index 5d8bdf1..32c49f4 100644 --- a/app/app.js +++ b/app/app.js @@ -6,6 +6,7 @@ module.exports.nba = require('./services/nba.service'); module.exports.ncaa = require('./services/ncaa.service'); module.exports.nfl = require('./services/nfl.service'); module.exports.nhl = require('./services/nhl.service'); +module.exports.tnns = require('./services/tnns.service'); module.exports.wbb = require('./services/wbb.service'); module.exports.wnba = require('./services/wnba.service'); diff --git a/app/services/cfb.service.js b/app/services/cfb.service.js index 8ffdb21..7908422 100644 --- a/app/services/cfb.service.js +++ b/app/services/cfb.service.js @@ -16,7 +16,7 @@ module.exports = { * @example * const result = await sdv.cfb.getPlayByPlay(401256194); */ - getPlayByPlay: async function(id) { + getPlayByPlay: async function (id) { const baseUrl = 'http://cdn.espn.com/core/college-football/playbyplay'; const params = { gameId: id, @@ -51,7 +51,7 @@ module.exports = { * @example * const result = await sdv.cfb.getBoxScore(401256194); */ - getBoxScore: async function (id){ + getBoxScore: async function (id) { const baseUrl = 'http://cdn.espn.com/core/college-football/boxscore'; const params = { gameId: id, @@ -80,7 +80,7 @@ module.exports = { * @example * const result = await sdv.cfb.getSummary(401256194); */ - getSummary: async function(id) { + getSummary: async function (id) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/football/college-football/summary'; const params = { event: id @@ -117,7 +117,7 @@ module.exports = { * @example * const result = await sdv.cfb.getPicks(401256194); */ - getPicks: async function(id) { + getPicks: async function (id) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/football/college-football/summary'; const params = { event: id @@ -157,7 +157,7 @@ module.exports = { * @example * const result = await sdv.cfb.getPlayerRankings({year: 2016}); */ - getPlayerRankings: async function({ + getPlayerRankings: async function ({ year, page = 1, group = "HighSchool", @@ -174,7 +174,7 @@ module.exports = { const res = await axios.get(baseUrl, { headers: { - 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' + 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' }, params }); @@ -192,15 +192,15 @@ module.exports = { let metrics = html.find('.metrics').text().split('/'); let player = { - ranking: rank, - name: html.find('.rankings-page__name-link').text().trim(), - highSchool: html.find('span.meta').text().trim(), - position: html.find('.position').text().trim(), - height: metrics[0], - weight: metrics[1], - stars: html.find('.rankings-page__star-and-score > .yellow').length, - rating: html.find('.score').text().trim().trim(), - college: html.find('.img-link > img').attr('title') || 'uncommitted' + ranking: rank, + name: html.find('.rankings-page__name-link').text().trim(), + highSchool: html.find('span.meta').text().trim(), + position: html.find('.position').text().trim(), + height: metrics[0], + weight: metrics[1], + stars: html.find('.rankings-page__star-and-score > .yellow').length, + rating: html.find('.score').text().trim().trim(), + college: html.find('.img-link > img').attr('title') || 'uncommitted' }; players.push(player); @@ -220,15 +220,15 @@ module.exports = { * @example * const result = await sdv.cfb.getSchoolRankings({year: 2016}); */ - getSchoolRankings: async function(year, page = 1) { + getSchoolRankings: async function (year, page = 1) { const baseUrl = `http://247sports.com/Season/${year}-Football/CompositeTeamRankings`; const res = await axios.get(baseUrl, { headers: { - 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' + 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' }, params: { - Page: page + Page: page } }); @@ -239,14 +239,14 @@ module.exports = { let html = $(this); let school = { - rank: html.find('.rank-column .primary').text().trim(), - school: html.find('.rankings-page__name-link').text().trim(), - totalCommits: html.find('.total a').text().trim(), - fiveStars: $(html.find('ul.star-commits-list > li > div')[0]).text().replace('5: ', '').trim(), - fourStars: $(html.find('ul.star-commits-list > li > div')[1]).text().replace('4: ', '').trim(), - threeStars: $(html.find('ul.star-commits-list > li > div')[2]).text().replace('3: ', '').trim(), - averageRating: html.find('.avg').text().trim(), - points: html.find('.number').text().trim() + rank: html.find('.rank-column .primary').text().trim(), + school: html.find('.rankings-page__name-link').text().trim(), + totalCommits: html.find('.total a').text().trim(), + fiveStars: $(html.find('ul.star-commits-list > li > div')[0]).text().replace('5: ', '').trim(), + fourStars: $(html.find('ul.star-commits-list > li > div')[1]).text().replace('4: ', '').trim(), + threeStars: $(html.find('ul.star-commits-list > li > div')[2]).text().replace('3: ', '').trim(), + averageRating: html.find('.avg').text().trim(), + points: html.find('.number').text().trim() }; schools.push(school); @@ -265,12 +265,12 @@ module.exports = { * @example * const result = await sdv.cfb.getSchoolCommits({school: 'Florida State', year: 2021}); */ - getSchoolCommits: async function(school, year){ + getSchoolCommits: async function (school, year) { const baseUrl = `http://${school}.247sports.com/Season/${year}-Football/Commits`; const res = await axios.get(baseUrl, { headers: { - 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' + 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' } }); @@ -284,16 +284,16 @@ module.exports = { let metrics = html.find('.metrics').text().split('/'); let player = { - name: html.find('.ri-page__name-link').text().trim(), - highSchool: html.find('span.meta').text().trim(), - position: $(html.find('.position')).text().trim(), - height: metrics[0], - weight: metrics[1], - stars: html.find('.ri-page__star-and-score .yellow').length, - rating: html.find('span.score').clone().children().remove().end().text().trim(), - nationalRank: html.find('.natrank').first().text().trim(), - stateRank: html.find('.sttrank').first().text().trim(), - positionRank: html.find('.posrank').first().text().trim() + name: html.find('.ri-page__name-link').text().trim(), + highSchool: html.find('span.meta').text().trim(), + position: $(html.find('.position')).text().trim(), + height: metrics[0], + weight: metrics[1], + stars: html.find('.ri-page__star-and-score .yellow').length, + rating: html.find('span.score').clone().children().remove().end().text().trim(), + nationalRank: html.find('.natrank').first().text().trim(), + stateRank: html.find('.sttrank').first().text().trim(), + positionRank: html.find('.posrank').first().text().trim() }; players.push(player); @@ -317,23 +317,22 @@ module.exports = { * @example * const result = await sdv.cfb.getRankings(year = 2020, week = 4) */ - getRankings: async function({year = null, week = null}) { - const baseUrl = 'http://cdn.espn.com/core/college-football/rankings?'; - const qs = {}; + getRankings: async function ({ year, week }) { + const baseUrl = 'http://cdn.espn.com/core/college-football/rankings'; + const params = {}; if (year) { - qs.year = year; + params.year = year; } if (week) { - qs.week = week; + params.week = week; } const res = await axios.get(baseUrl, { - params: qs + params }); - - return res.content.data; + return res.data; }, /** * Gets the College Football schedule data for a specified date if available. @@ -349,8 +348,8 @@ module.exports = { * @example * const result = await sdv.cfb.getSchedule(year = 2019, month = 11, day = 16, group=80) */ - getSchedule: async function ({year = null, month = null, day = null, groups = 80, seasontype = 2}){ - const baseUrl = `http://cdn.espn.com/core/college-football/schedule?dates=${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + getSchedule: async function ({ year, month, day, groups = 80, seasontype = 2 }) { + const baseUrl = `http://cdn.espn.com/core/college-football/schedule`; const params = { groups: groups, seasontype: seasontype, @@ -359,6 +358,9 @@ module.exports = { device: 'desktop', userab: 18 }; + if (year && month && day) { + params.dates = `${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + } const res = await axios.get(baseUrl, { params @@ -382,14 +384,17 @@ module.exports = { * year = 2019, month = 11, day = 16, group=80 * ) */ - getScoreboard: async function({year = null, month = null, day = null, groups = 80, seasontype = 2, limit = 300}) { + getScoreboard: async function ({ year, month, day, groups = 80, seasontype = 2, limit = 300 }) { - const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard?dates=${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard`; const params = { groups: groups, seasontype, limit }; + if (year && month && day) { + params.dates = `${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + } const res = await axios.get(baseUrl, { params @@ -409,7 +414,7 @@ module.exports = { * const yr = 2021; * const result = await sdv.cfb.getConferences(year = yr, group = 80); */ - getConferences: async function ({year = new Date().getFullYear(), group = 80}){ + getConferences: async function ({ year = new Date().getFullYear(), group = 80 }) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard/conferences'; const params = { @@ -433,7 +438,7 @@ module.exports = { * const yr = 2020; * const result = await sdv.cfb.getStandings(year = yr); */ - getStandings: async function ({year = new Date().getFullYear(), group = 80}){ + getStandings: async function ({ year = new Date().getFullYear(), group = 80 }) { const baseUrl = `https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings`; const params = { region: 'us', @@ -443,9 +448,9 @@ module.exports = { group: group, type: 0, level: 1, - sort: 'winpercent:desc,leaguewinpercent:desc,vsconf_winpercent:desc,'+ - 'vsconf_gamesbehind:asc,vsconf_playoffseed:asc,wins:desc,'+ - 'losses:desc,playoffseed:asc,alpha:asc' + sort: 'winpercent:desc,leaguewinpercent:desc,vsconf_winpercent:desc,' + + 'vsconf_gamesbehind:asc,vsconf_playoffseed:asc,wins:desc,' + + 'losses:desc,playoffseed:asc,alpha:asc' }; const res = await axios.get(baseUrl, { params @@ -462,7 +467,7 @@ module.exports = { * @example * const result = await sdv.cfb.getTeamList(group=80); */ - getTeamList: async function ({group = 80}) { + getTeamList: async function ({ group = 80 }) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams'; const params = { group, @@ -486,7 +491,7 @@ module.exports = { * const teamId = 52; * const result = await sdv.cfb.getTeamInfo(teamId); */ - getTeamInfo: async function(id) { + getTeamInfo: async function (id) { const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/${id}`; const res = await axios.get(baseUrl); diff --git a/app/services/mbb.service.js b/app/services/mbb.service.js index 8dc8abe..ce506cd 100644 --- a/app/services/mbb.service.js +++ b/app/services/mbb.service.js @@ -146,23 +146,23 @@ module.exports = { * year = 2020, week = 15 * ) */ - getRankings: async function ({year = null, week = null}) { - const baseUrl = 'http://cdn.espn.com/core/mens-college-basketball/rankings?'; - const qs = {}; + getRankings: async function ({ year, week }) { + const baseUrl = 'http://cdn.espn.com/core/mens-college-basketball/rankings'; + const params = {}; if (year) { - qs.year = year; + params.year = year; } if (week) { - qs.week = week; + params.week = week; } const res = await axios.get(baseUrl, { - params: qs + params }); - return res.content.data; + return res.data; }, /** * Gets the Men's College Basketball Player recruiting data for a specified year, page, position and institution type if available. @@ -176,7 +176,7 @@ module.exports = { * @example * const result = await sdv.mbb.getPlayerRankings({year: 2016}); */ - getPlayerRankings: async function({ + getPlayerRankings: async function ({ year, page = 1, group = "HighSchool", @@ -185,37 +185,37 @@ module.exports = { }) { const baseUrl = `http://247sports.com/Season/${year}-Basketball/CompositeRecruitRankings`; const params = { - InstitutionGroup: group, - Page: page, - Position: position, - State: state + InstitutionGroup: group, + Page: page, + Position: position, + State: state }; const res = await axios.get(baseUrl, { - headers: { - 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' - }, - params + headers: { + 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' + }, + params }); let $ = cheerio.load(res.data); let players = []; // Couldn't grab the rank correctly with JQuery so it's manually calculated let rank = 1 + 50 * (page - 1); $('ul.rankings-page__list > li.rankings-page__list-item:not(.rankings-page__list-item--header)').each(function (index) { - let html = $(this); - let metrics = html.find('.metrics').text().split('/'); - let player = { - ranking: rank, - name: html.find('.rankings-page__name-link').text().trim(), - highSchool: html.find('span.meta').text().trim(), - position: html.find('.position').text().trim(), - height: metrics[0], - weight: metrics[1], - stars: html.find('.rankings-page__star-and-score > .yellow').length, - rating: html.find('.score').text().trim().trim(), - college: html.find('.img-link > img').attr('title') || 'uncommitted' - }; - players.push(player); - rank++; + let html = $(this); + let metrics = html.find('.metrics').text().split('/'); + let player = { + ranking: rank, + name: html.find('.rankings-page__name-link').text().trim(), + highSchool: html.find('span.meta').text().trim(), + position: html.find('.position').text().trim(), + height: metrics[0], + weight: metrics[1], + stars: html.find('.rankings-page__star-and-score > .yellow').length, + rating: html.find('.score').text().trim().trim(), + college: html.find('.img-link > img').attr('title') || 'uncommitted' + }; + players.push(player); + rank++; }); return players; }, @@ -235,10 +235,10 @@ module.exports = { const baseUrl = `http://247sports.com/Season/${year}-Basketball/CompositeTeamRankings`; const res = await axios.get(baseUrl, { headers: { - 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' + 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' }, params: { - Page: page + Page: page } }); let $ = cheerio.load(res.data); @@ -246,14 +246,14 @@ module.exports = { $('.rankings-page__list-item').each(function (index) { let html = $(this); let school = { - rank: html.find('.rank-column .primary').text().trim(), - school: html.find('.rankings-page__name-link').text().trim(), - totalCommits: html.find('.total a').text().trim(), - fiveStars: $(html.find('ul.star-commits-list > li > div')[0]).text().replace('5: ', '').trim(), - fourStars: $(html.find('ul.star-commits-list > li > div')[1]).text().replace('4: ', '').trim(), - threeStars: $(html.find('ul.star-commits-list > li > div')[2]).text().replace('3: ', '').trim(), - averageRating: html.find('.avg').text().trim(), - points: html.find('.number').text().trim() + rank: html.find('.rank-column .primary').text().trim(), + school: html.find('.rankings-page__name-link').text().trim(), + totalCommits: html.find('.total a').text().trim(), + fiveStars: $(html.find('ul.star-commits-list > li > div')[0]).text().replace('5: ', '').trim(), + fourStars: $(html.find('ul.star-commits-list > li > div')[1]).text().replace('4: ', '').trim(), + threeStars: $(html.find('ul.star-commits-list > li > div')[2]).text().replace('3: ', '').trim(), + averageRating: html.find('.avg').text().trim(), + points: html.find('.number').text().trim() }; schools.push(school); }); @@ -270,11 +270,11 @@ module.exports = { * @example * const result = await sdv.mbb.getSchoolCommits({school: 'Clemson', year: 2016}); */ - getSchoolCommits: async function(school, year) { + getSchoolCommits: async function (school, year) { const baseUrl = `http://${school}.247sports.com/Season/${year}-Basketball/Commits`; const res = await axios.get(baseUrl, { headers: { - 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' + 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' } }); let $ = cheerio.load(res.data); @@ -283,16 +283,16 @@ module.exports = { let html = $(this); let metrics = html.find('.metrics').text().split('/'); let player = { - name: html.find('.ri-page__name-link').text().trim(), - highSchool: html.find('span.meta').text().trim(), - position: $(html.find('.position')).text().trim(), - height: metrics[0], - weight: metrics[1], - stars: html.find('.ri-page__star-and-score .yellow').length, - rating: html.find('span.score').clone().children().remove().end().text().trim(), - nationalRank: html.find('.natrank').first().text().trim(), - stateRank: html.find('.sttrank').first().text().trim(), - positionRank: html.find('.posrank').first().text().trim() + name: html.find('.ri-page__name-link').text().trim(), + highSchool: html.find('span.meta').text().trim(), + position: $(html.find('.position')).text().trim(), + height: metrics[0], + weight: metrics[1], + stars: html.find('.ri-page__star-and-score .yellow').length, + rating: html.find('span.score').clone().children().remove().end().text().trim(), + nationalRank: html.find('.natrank').first().text().trim(), + stateRank: html.find('.sttrank').first().text().trim(), + positionRank: html.find('.posrank').first().text().trim() }; players.push(player); }); @@ -319,7 +319,7 @@ module.exports = { * year = 2021, month = 02, day = 15, group=50 * ) */ - getSchedule: async function({ + getSchedule: async function ({ year = null, month = null, day = null, @@ -355,20 +355,22 @@ module.exports = { * year = 2021, month = 02, day = 15, group=50 * ) */ - getScoreboard: async function({ - year = null, - month = null, - day = null, + getScoreboard: async function ({ + year, + month, + day, group = 50, seasontype = 2, - limit = 1000}) { - const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/scoreboard?dates=${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + limit = 1000 }) { + const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/scoreboard`; const params = { groups: group, seasontype: seasontype || 2, limit }; - + if (year && month && day) { + params.dates = `${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + } const res = await axios.get(baseUrl, { params }); @@ -387,7 +389,7 @@ module.exports = { * const yr = 2021; * const result = await sdv.mbb.getConferences(year = yr, group = 50); */ - getConferences: async function ({year = new Date().getFullYear(), group = 50}){ + getConferences: async function ({ year = new Date().getFullYear(), group = 50 }) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/scoreboard/conferences'; const params = { @@ -412,7 +414,7 @@ module.exports = { * const yr = 2020; * const result = await sdv.mbb.getStandings(year = yr); */ - getStandings: async function ({year = new Date().getFullYear(), group = 50}){ + getStandings: async function ({ year = new Date().getFullYear(), group = 50 }) { const baseUrl = `https://site.web.api.espn.com/apis/v2/sports/basketball/mens-college-basketball/standings`; const params = { region: 'us', @@ -422,9 +424,9 @@ module.exports = { group: group, type: 0, level: 1, - sort: 'leaguewinpercent:desc,vsconf_winpercent:desc,'+ - 'vsconf_gamesbehind:asc,vsconf_playoffseed:asc,wins:desc,'+ - 'losses:desc,playoffseed:asc,alpha:asc' + sort: 'leaguewinpercent:desc,vsconf_winpercent:desc,' + + 'vsconf_gamesbehind:asc,vsconf_playoffseed:asc,wins:desc,' + + 'losses:desc,playoffseed:asc,alpha:asc' }; const res = await axios.get(baseUrl, { params @@ -441,7 +443,7 @@ module.exports = { * @example * const result = await sdv.mbb.getTeamList(group=50); */ - getTeamList: async function({ + getTeamList: async function ({ group = 50 }) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/teams'; @@ -484,7 +486,7 @@ module.exports = { * const teamId = 52; * const result = await sdv.mbb.getTeamPlayers(teamId); */ - getTeamPlayers: async function(id) { + getTeamPlayers: async function (id) { const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/teams/${id}`; const params = { enable: "roster" diff --git a/app/services/mlb.service.js b/app/services/mlb.service.js index 11abc13..cd98b50 100644 --- a/app/services/mlb.service.js +++ b/app/services/mlb.service.js @@ -86,15 +86,15 @@ module.exports = { boxScore: res.data.boxscore, gameInfo: res.data.gameInfo, header: res.data.header, - teams: res.data.gamepackageJSON.header.competitions[0].competitors, - id: res.data.gamepackageJSON.header.id, - plays: res.data.gamepackageJSON.plays, + teams: res.data.gamepackageJSON?.header.competitions[0].competitors, + id: res.data.gamepackageJSON?.header.id, + plays: res.data.gamepackageJSON?.plays, winProbability: res.data.winprobability, leaders: res.data.leaders, - competitions: res.data.gamepackageJSON.header.competitions, - season: res.data.gamepackageJSON.header.season, - seasonSeries: res.data.gamepackageJSON.seasonseries, - standings: res.data.gamepackageJSON.standings, + competitions: res.data.gamepackageJSON?.header.competitions, + season: res.data.gamepackageJSON?.header.season, + seasonSeries: res.data.gamepackageJSON?.seasonseries, + standings: res.data.gamepackageJSON?.standings, }; }, /** @@ -146,16 +146,18 @@ module.exports = { * year = 2016, month = 04, day = 15 * ) */ - getSchedule: async function ({ year = null, month = null, day = null }) { - const baseUrl = `http://cdn.espn.com/core/mlb/schedule?dates=${year}${ - parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month) - }${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + getSchedule: async function ({ year, month, day }) { + const baseUrl = `http://cdn.espn.com/core/mlb/schedule`; + const params = { xhr: 1, render: false, device: "desktop", userab: 18, }; + if (year && month && day) { + params.dates = `${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + } const res = await axios.get(baseUrl, { params, }); @@ -177,17 +179,18 @@ module.exports = { * ) */ getScoreboard: async function ({ - year = null, - month = null, - day = null, + year, + month, + day, limit = 300, }) { - const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/baseball/mlb/scoreboard?dates=${year}${ - parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month) - }${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/baseball/mlb/scoreboard`; const params = { limit, }; + if (year && month && day) { + params.dates = `${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + } const res = await axios.get(baseUrl, { params, }); diff --git a/app/services/nba.service.js b/app/services/nba.service.js index aee5a3e..7240bd0 100644 --- a/app/services/nba.service.js +++ b/app/services/nba.service.js @@ -15,7 +15,7 @@ module.exports = { * @example * const result = await sdv.nba.getPlayByPlay(401283399); */ - getPlayByPlay: async function (id){ + getPlayByPlay: async function (id) { const baseUrl = 'http://cdn.espn.com/core/nba/playbyplay'; const params = { gameId: id, @@ -47,7 +47,7 @@ module.exports = { * @example * const result = await sdv.nba.getBoxScore(401283399); */ - getBoxScore: async function (id){ + getBoxScore: async function (id) { const baseUrl = 'http://cdn.espn.com/core/nba/boxscore'; const params = { gameId: id, @@ -73,7 +73,7 @@ module.exports = { * @example * const result = await sdv.nba.getSummary(401283399); */ - getSummary: async function (id){ + getSummary: async function (id) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/basketball/nba/summary'; const params = { event: id @@ -85,15 +85,15 @@ module.exports = { boxScore: res.data.boxscore, gameInfo: res.data.gameInfo, header: res.data.header, - teams: res.data.gamepackageJSON.header.competitions[0].competitors, - id: res.data.gamepackageJSON.header.id, - plays: res.data.gamepackageJSON.plays, + teams: res.data.gamepackageJSON?.header?.competitions[0].competitors, + id: res.data.gamepackageJSON?.header?.id, + plays: res.data.gamepackageJSON?.plays, winProbability: res.data.winprobability, leaders: res.data.leaders, - competitions: res.data.gamepackageJSON.header.competitions, - season: res.data.gamepackageJSON.header.season, - seasonSeries: res.data.gamepackageJSON.seasonseries, - standings: res.data.gamepackageJSON.standings + competitions: res.data.gamepackageJSON?.header?.competitions, + season: res.data.gamepackageJSON?.header?.season, + seasonSeries: res.data.gamepackageJSON?.seasonseries, + standings: res.data.gamepackageJSON?.standings }; }, /** @@ -106,7 +106,7 @@ module.exports = { * @example * const result = await sdv.nba.getPicks(401283399); */ - getPicks: async function (id){ + getPicks: async function (id) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/basketball/nba/summary'; const params = { event: id @@ -144,7 +144,7 @@ module.exports = { * year = 2016, month = 04, day = 15 * ) */ - getSchedule: async function ({year = null, month = null, day = null}){ + getSchedule: async function ({ year = null, month = null, day = null }) { const baseUrl = `http://cdn.espn.com/core/nba/schedule?dates=${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; const params = { xhr: 1, @@ -172,11 +172,14 @@ module.exports = { * year = 2019, month = 11, day = 16 * ) */ - getScoreboard: async function ({year = null, month = null, day = null, limit = 300}){ - const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/nba/scoreboard?dates=${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + getScoreboard: async function ({ year, month, day, limit = 300 }) { + const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/nba/scoreboard`; const params = { limit }; + if (year && month && day) { + params.dates = `${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + } const res = await axios.get(baseUrl, { params }); @@ -194,7 +197,7 @@ module.exports = { * const yr = 2016; * const result = await sdv.nba.getStandings(year = yr); */ - getStandings: async function ({year = new Date().getFullYear(), group = 'league'}){ + getStandings: async function ({ year = new Date().getFullYear(), group = 'league' }) { const groupId = group === 'league' ? 1 : group === 'conference' ? 2 : 3; const baseUrl = `https://site.web.api.espn.com/apis/v2/sports/basketball/nba/standings`; const params = { @@ -219,7 +222,7 @@ module.exports = { * @example * const result = await sdv.nba.getTeamList(); */ - getTeamList: async function (){ + getTeamList: async function () { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/basketball/nba/teams'; const params = { limit: 1000 @@ -242,7 +245,7 @@ module.exports = { * const teamId = 16; * const result = await sdv.nba.getTeamInfo(teamId); */ - getTeamInfo: async function (id){ + getTeamInfo: async function (id) { const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/nba/teams/${id}`; const res = await axios.get(baseUrl); @@ -259,7 +262,7 @@ module.exports = { * const teamId = 16; * const result = await sdv.nba.getTeamPlayers(teamId); */ - getTeamPlayers: async function (id){ + getTeamPlayers: async function (id) { const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/nba/teams/${id}`; const params = { enable: "roster" diff --git a/app/services/ncaa.service.js b/app/services/ncaa.service.js index b0d8c70..2c90516 100644 --- a/app/services/ncaa.service.js +++ b/app/services/ncaa.service.js @@ -23,7 +23,7 @@ module.exports = { * const urlGame = result["games"][16]["game"]["url"] * const gameId = await sdv.ncaa.getRedirectUrl(url=urlGame); */ - getRedirectUrl: async function (url){ + getRedirectUrl: async function (url) { const baseUrl = `https://ncaa.com/${url}`; const response = await axios.get(baseUrl); const gameUrl = response.request.res.responseUrl; @@ -40,7 +40,7 @@ module.exports = { * @example * const result = await sdv.ncaa.getInfo(5764053); */ - getInfo: async function (game){ + getInfo: async function (game) { const baseUrl = `https://data.ncaa.com/casablanca/game/${game}/gameInfo.json`; const res = await axios.get(baseUrl); return res.data; @@ -55,7 +55,7 @@ module.exports = { * @example * const result = await sdv.ncaa.getBoxScore(5764053); */ - getBoxScore: async function (game){ + getBoxScore: async function (game) { const baseUrl = `https://data.ncaa.com/casablanca/game/${game}/boxscore.json`; const res = await axios.get(baseUrl); return res.data; @@ -70,7 +70,7 @@ module.exports = { * @example * const result = await sdv.ncaa.getPlayByPlay(5764053); */ - getPlayByPlay: async function (game){ + getPlayByPlay: async function (game) { const baseUrl = `https://data.ncaa.com/casablanca/game/${game}/pbp.json`; const res = await axios.get(baseUrl); return res.data; @@ -85,7 +85,7 @@ module.exports = { * @example * const result = await sdv.ncaa.getTeamStats(5764053); */ - getTeamStats: async function (game){ + getTeamStats: async function (game) { const baseUrl = `https://data.ncaa.com/casablanca/game/${game}/teamStats.json`; const res = await axios.get(baseUrl); return res.data; @@ -100,7 +100,7 @@ module.exports = { * @example * const result = await sdv.ncaa.getScoringSummary(5764053); */ - getScoringSummary: async function (game){ + getScoringSummary: async function (game) { const baseUrl = `https://data.ncaa.com/casablanca/game/${game}/scoringSummary.json`; const res = await axios.get(baseUrl); return res.data; @@ -128,9 +128,8 @@ module.exports = { * sport = 'basketball-men', division = 'd3', year = 2019, month = 02, day = 15 * ) */ - getScoreboard: async function (sport,division,year,month ,day){ + getScoreboard: async function ({ sport, division, year, month, day }) { const baseUrl = `https://data.ncaa.com/casablanca/scoreboard/${sport}/${division}/${year}/${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}/${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}/scoreboard.json`; - const res = await axios.get(baseUrl); return res.data; }, @@ -156,7 +155,7 @@ module.exports = { * @example * const result = sdv.ncaa.getSports(); */ - getSports: async function (){ + getSports: async function () { const baseUrl = 'http://stats.ncaa.org/'; const res = await axios.get(baseUrl) @@ -189,7 +188,7 @@ module.exports = { * @example * const result = sdv.ncaa.getSeasons(sport='MBB'); */ - getSeasons: async function (sport){ + getSeasons: async function (sport) { if (!sport) { return; } @@ -244,7 +243,7 @@ module.exports = { * @example * const result = sdv.ncaa.getDivisions(sport='MBB', season='2017'); */ - getDivisions: async function (sport, season){ + getDivisions: async function (sport, season) { if (!sport || !season) { return; } @@ -305,7 +304,7 @@ module.exports = { * @example * const sportDivisionData = sdv.ncaa.getSportDivisionData(sport='MFB',season='2016',division=12,type='team',gameHigh=true); */ - getSportDivisionData: async function(sport, season, division, type, gameHigh){ + getSportDivisionData: async function (sport, season, division, type, gameHigh) { if (!sport || !season || !division) { return; } @@ -376,7 +375,7 @@ module.exports = { * @example * const players = await sdv.ncaa.getPlayerData(sport = 'MFB', year = '2017', division = '11',rankingPeriod = '52', gameHigh='N', category = '20') */ - getPlayerData: async function (sport, season, division, rankingPeriod, gameHigh, category){ + getPlayerData: async function (sport, season, division, rankingPeriod, gameHigh, category) { const baseUrl = 'http://stats.ncaa.org/rankings/change_sport_year_div'; const params = { "sport_code": sport, @@ -393,7 +392,7 @@ module.exports = { "ncaa_custom_rank_summary_id": "-1", "user_custom_rank_summary_id": -1 }; - const res = await axios.get(baseUrl,{ + const res = await axios.get(baseUrl, { params }); @@ -429,7 +428,7 @@ module.exports = { * @example * const teams = await sdv.ncaa.getTeamData(sport = 'MFB', year = '2017', division = '11', rankingPeriod = '52', gameHigh='N', category = '20') */ - getTeamData: async function (sport, season, division, rankingPeriod, gameHigh, category){ + getTeamData: async function (sport, season, division, rankingPeriod, gameHigh, category) { const baseUrl = 'http://stats.ncaa.org/rankings/change_sport_year_div'; const params = { "sport_code": sport, @@ -446,7 +445,7 @@ module.exports = { "ncaa_custom_rank_summary_id": "-1", "user_custom_rank_summary_id": -1 }; - const res = await axios.get(baseUrl,{ + const res = await axios.get(baseUrl, { params }); diff --git a/app/services/nfl.service.js b/app/services/nfl.service.js index d7254d7..fc796c1 100644 --- a/app/services/nfl.service.js +++ b/app/services/nfl.service.js @@ -15,7 +15,7 @@ module.exports = { * @example * const result = await sdv.nfl.getPlayByPlay(401220403); */ - getPlayByPlay: async function (id){ + getPlayByPlay: async function (id) { const baseUrl = 'http://cdn.espn.com/core/nfl/playbyplay'; const params = { gameId: id, @@ -48,7 +48,7 @@ module.exports = { * @example * const result = await sdv.nfl.getBoxScore(401220403); */ - getBoxScore: async function (id){ + getBoxScore: async function (id) { const baseUrl = 'http://cdn.espn.com/core/nfl/boxscore'; const params = { gameId: id, @@ -74,7 +74,7 @@ module.exports = { * @example * const result = await sdv.nfl.getSummary(401220403); */ - getSummary: async function (id){ + getSummary: async function (id) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/football/nfl/summary'; const params = { event: id @@ -111,7 +111,7 @@ module.exports = { * @example * const result = await sdv.nfl.getPicks(401220403); */ - getPicks: async function (id){ + getPicks: async function (id) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/football/nfl/summary'; const params = { event: id @@ -149,7 +149,7 @@ module.exports = { * year = 2019, month = 11, day = 17 * ) */ - getSchedule: async function ({year = null, month = null, day = null}){ + getSchedule: async function ({ year = null, month = null, day = null }) { const baseUrl = `http://cdn.espn.com/core/nfl/schedule?dates=${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; const params = { xhr: 1, @@ -177,11 +177,15 @@ module.exports = { * year = 2019, month = 11, day = 17 * ) */ - getScoreboard: async function ({year = null, month = null, day = null, limit = 300}){ - const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard?dates=${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + getScoreboard: async function ({ year, month, day, limit = 300 }) { + const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard`; + const params = { limit }; + if (year && month && day) { + params.dates = `${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + } const res = await axios.get(baseUrl, { params }); @@ -199,7 +203,7 @@ module.exports = { * const yr = 2021; * const result = await sdv.nfl.getStandings(year = yr); */ - getStandings: async function ({year = new Date().getFullYear(), group = 'league'}){ + getStandings: async function ({ year = new Date().getFullYear(), group = 'league' }) { const groupId = group === 'league' ? 1 : group === 'conference' ? 2 : 3; const baseUrl = `https://site.web.api.espn.com/apis/v2/sports/football/nfl/standings`; const params = { @@ -223,7 +227,7 @@ module.exports = { * @example * const result = await sdv.nfl.getTeamList(); */ - getTeamList: async function (){ + getTeamList: async function () { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/football/nfl/teams'; const params = { limit: 1000 @@ -244,7 +248,7 @@ module.exports = { * const teamId = 16; * const result = await sdv.nfl.getTeamInfo(teamId); */ - getTeamInfo: async function (id){ + getTeamInfo: async function ({ id }) { const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/football/nfl/teams/${id}`; const res = await axios.get(baseUrl); return res.data; @@ -260,7 +264,7 @@ module.exports = { * const teamId = 16; * const result = await sdv.nfl.getTeamPlayers(teamId); */ - getTeamPlayers: async function (id){ + getTeamPlayers: async function ({ id }) { const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/football/nfl/teams/${id}`; const params = { enable: "roster" diff --git a/app/services/nhl.service.js b/app/services/nhl.service.js index ff62ba0..527c5f1 100644 --- a/app/services/nhl.service.js +++ b/app/services/nhl.service.js @@ -15,7 +15,7 @@ module.exports = { * @example * const result = await sdv.nhl.getPlayByPlay(401272446); */ - getPlayByPlay: async function (id){ + getPlayByPlay: async function (id) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/summary'; const params = { event: id @@ -47,7 +47,7 @@ module.exports = { * @example * const result = await sdv.nhl.getBoxScore(401272446); */ - getBoxScore: async function (id){ + getBoxScore: async function (id) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/summary'; const params = { event: id @@ -72,7 +72,7 @@ module.exports = { * @example * const result = await sdv.nhl.getSummary(401272446); */ - getSummary: async function (id){ + getSummary: async function (id) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/summary'; const params = { event: id @@ -107,7 +107,7 @@ module.exports = { * @example * const result = await sdv.nhl.getPicks(401272446); */ - getPicks: async function (id){ + getPicks: async function (id) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/summary'; const params = { event: id @@ -146,7 +146,7 @@ module.exports = { * year = 2019, month = 11, day = 17 * ) */ - getSchedule: async function ({year = null, month = null, day = null}){ + getSchedule: async function ({ year = null, month = null, day = null }) { const baseUrl = `http://cdn.espn.com/core/nhl/schedule?dates=${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; const params = { xhr: 1, @@ -175,11 +175,14 @@ module.exports = { * year = 2019, month = 11, day = 16 * ) */ - getScoreboard: async function ({year = null, month = null, day = null, limit = 300}){ - const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/scoreboard?dates=${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + getScoreboard: async function ({ year, month, day, limit = 300 }) { + const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/scoreboard`; const params = { limit }; + if (year && month && day) { + params.dates = `${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + } const res = await axios.get(baseUrl, { params @@ -199,7 +202,7 @@ module.exports = { * const yr = 2016; * const result = await sdv.nhl.getStandings(year = yr); */ - getStandings: async function ({year = new Date().getFullYear(), group = 'league'}){ + getStandings: async function ({ year = new Date().getFullYear(), group = 'league' }) { const groupId = group === 'league' ? 1 : group === 'conference' ? 2 : 3; const baseUrl = `https://site.web.api.espn.com/apis/v2/sports/hockey/nhl/standings`; const params = { @@ -224,7 +227,7 @@ module.exports = { * @example * const result = await sdv.nhl.getTeamList(); */ - getTeamList: async function (){ + getTeamList: async function () { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/teams'; const params = { limit: 1000 @@ -247,7 +250,7 @@ module.exports = { * const teamId = 16; * const result = await sdv.nhl.getTeamInfo(teamId); */ - getTeamInfo: async function (id){ + getTeamInfo: async function (id) { const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/teams/${id}`; const res = await axios.get(baseUrl); @@ -264,7 +267,7 @@ module.exports = { * const teamId = 16; * const result = await sdv.nhl.getTeamPlayers(teamId); */ - getTeamPlayers: async function (id){ + getTeamPlayers: async function (id) { const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/teams/${id}`; const params = { enable: "roster" diff --git a/app/services/tnns.service.js b/app/services/tnns.service.js new file mode 100644 index 0000000..0666ef3 --- /dev/null +++ b/app/services/tnns.service.js @@ -0,0 +1,35 @@ +const axios = require('axios'); +/** + * Operations for Tennis. + * + * @namespace tnns + */ +module.exports = { + /** + * Gets the scoreboard data for a specified date and league if available. + * @memberOf tnns + * @async + * @function + * @param {string} league - Tennis league desired. Default 'atp' Acceptable values: + * ['atp', 'wta'] + * @param {*} year - Year (YYYY) + * @param {*} month - Month (MM) + * @param {*} day - Day (DD) + * @returns json + * @example + * const result = await sdv.tnns.getScoreboard({ + * league = 'wta', year = 2023, month = 06, day = 20 + * }) + */ + getScoreboard: async function ({ league = 'atp', year, month, day }) { + const baseUrl = `https://site.api.espn.com/apis/site/v2/sports/tennis/${league}/scoreboard`; + const params = {}; + if (year && month && day) { + params.dates = `${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + } + const res = await axios.get(baseUrl, { + params, + }); + return res.data; + } +}; \ No newline at end of file diff --git a/app/services/wbb.service.js b/app/services/wbb.service.js index ec56287..6f17194 100644 --- a/app/services/wbb.service.js +++ b/app/services/wbb.service.js @@ -15,7 +15,7 @@ module.exports = { * @example * const result = await sdv.wbb.getPlayByPlay(401260565); */ - getPlayByPlay: async function (id){ + getPlayByPlay: async function (id) { const baseUrl = 'http://cdn.espn.com/core/womens-college-basketball/playbyplay'; const params = { gameId: id, @@ -47,7 +47,7 @@ module.exports = { * @example * const result = await sdv.wbb.getBoxScore(401260565); */ - getBoxScore: async function (id){ + getBoxScore: async function (id) { const baseUrl = 'http://cdn.espn.com/core/womens-college-basketball/boxscore'; const params = { gameId: id, @@ -76,7 +76,7 @@ module.exports = { * @example * const result = await sdv.wbb.getSummary(401260565); */ - getSummary: async function (id){ + getSummary: async function (id) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/summary'; const params = { event: id @@ -111,25 +111,25 @@ module.exports = { * ) */ getRankings: async function ({ - year = null, - week = null - }){ - const baseUrl = 'http://cdn.espn.com/core/womens-college-basketball/rankings?'; - const qs = {}; + year, + week + }) { + const baseUrl = 'http://cdn.espn.com/core/womens-college-basketball/rankings'; + const params = {}; if (year) { - qs.year = year; + params.year = year; } if (week) { - qs.week = week; + params.week = week; } const res = await axios.get(baseUrl, { - params: qs + params }); - return res.content.data; + return res.data; }, /** @@ -150,14 +150,17 @@ module.exports = { * ) */ getSchedule: async function ({ - year = null, - month = null, - day = null, + year, + month, + day, groups = 50, seasontype = 2, - limit=300 - }){ - const baseUrl = `http://cdn.espn.com/core/womens-college-basketball/schedule?dates=${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + limit = 300 + }) { + const baseUrl = `http://cdn.espn.com/core/womens-college-basketball/schedule`; + if (year && month && day) { + params.dates = `${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + } const params = { groups: groups, seasontype: seasontype, @@ -191,20 +194,22 @@ module.exports = { * ) */ getScoreboard: async function ({ - year = null, - month = null, - day = null, + year, + month, + day, group = 50, seasontype = 2, limit = 300 - }){ - const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/scoreboard?dates=${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + }) { + const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/scoreboard`; const params = { groups: group, seasontype: seasontype, limit }; - + if (year && month && day) { + params.dates = `${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + } const res = await axios.get(baseUrl, { params }); @@ -223,7 +228,7 @@ module.exports = { * const yr = 2021; * const result = await sdv.wbb.getConferences(year = yr, group = 50); */ - getConferences: async function ({year = new Date().getFullYear(), group = 50}){ + getConferences: async function ({ year = new Date().getFullYear(), group = 50 }) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/scoreboard/conferences'; const params = { @@ -247,7 +252,7 @@ module.exports = { * const yr = 2020; * const result = await sdv.wbb.getStandings(year = yr); */ - getStandings: async function ({year = new Date().getFullYear(), group = 50}){ + getStandings: async function ({ year = new Date().getFullYear(), group = 50 }) { const baseUrl = `https://site.web.api.espn.com/apis/v2/sports/basketball/womens-college-basketball/standings`; const params = { region: 'us', @@ -257,9 +262,9 @@ module.exports = { group: group, type: 0, level: 1, - sort: 'leaguewinpercent:desc,vsconf_winpercent:desc,'+ - 'vsconf_gamesbehind:asc,vsconf_playoffseed:asc,wins:desc,'+ - 'losses:desc,playoffseed:asc,alpha:asc' + sort: 'leaguewinpercent:desc,vsconf_winpercent:desc,' + + 'vsconf_gamesbehind:asc,vsconf_playoffseed:asc,wins:desc,' + + 'losses:desc,playoffseed:asc,alpha:asc' }; const res = await axios.get(baseUrl, { params @@ -277,7 +282,7 @@ module.exports = { * get list of teams * const result = await sdv.wbb.getTeamList(group=50); */ - getTeamList: async function ({group = 50}){ + getTeamList: async function ({ group = 50 }) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/teams'; const params = { group, @@ -299,7 +304,7 @@ module.exports = { * const teamId = 52; * const result = await sdv.wbb.getTeamInfo(teamId); */ - getTeamInfo: async function (id){ + getTeamInfo: async function (id) { const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/teams/${id}`; const res = await axios.get(baseUrl); @@ -316,7 +321,7 @@ module.exports = { * const teamId = 52; * const result = await sdv.wbb.getTeamPlayers(teamId); */ - getTeamPlayers: async function (id){ + getTeamPlayers: async function (id) { const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/teams/${id}`; const params = { enable: "roster" diff --git a/app/services/wnba.service.js b/app/services/wnba.service.js index a908ba5..ad26662 100644 --- a/app/services/wnba.service.js +++ b/app/services/wnba.service.js @@ -4,7 +4,7 @@ const axios = require('axios'); * * @namespace wnba */ - module.exports = { +module.exports = { /** * Gets the WNBA game play-by-play data for a specified game. * @memberOf wnba @@ -15,7 +15,7 @@ const axios = require('axios'); * @example * const result = await sdv.wnba.getPlayByPlay(401244185); */ - getPlayByPlay: async function (id){ + getPlayByPlay: async function (id) { const baseUrl = 'http://cdn.espn.com/core/wnba/playbyplay'; const params = { gameId: id, @@ -49,7 +49,7 @@ const axios = require('axios'); * @example * const result = await sdv.wnba.getBoxScore(401244185); */ - getBoxScore: async function (id){ + getBoxScore: async function (id) { const baseUrl = 'http://cdn.espn.com/core/wnba/boxscore'; const params = { gameId: id, @@ -78,7 +78,7 @@ const axios = require('axios'); * @example * const result = await sdv.wnba.getSummary(401244185); */ - getSummary: async function (id){ + getSummary: async function (id) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/summary'; const params = { event: id @@ -116,7 +116,7 @@ const axios = require('axios'); * year = 2019, month = 07, day = 15 * ) */ - getSchedule: async function ({year = null, month = null, day = null}){ + getSchedule: async function ({ year = null, month = null, day = null }) { const baseUrl = `http://cdn.espn.com/core/wnba/schedule?dates=${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; const params = { xhr: 1, @@ -145,11 +145,14 @@ const axios = require('axios'); * year = 2019, month = 07, day = 15 * ) */ - getScoreboard: async function ({year = null, month = null, day = null, limit = 300}){ - const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/scoreboard?dates=${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + getScoreboard: async function ({ year, month, day, limit = 300 }) { + const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/scoreboard`; const params = { limit }; + if (year && month && day) { + params.dates = `${year}${parseInt(month) <= 9 ? "0" + parseInt(month) : parseInt(month)}${parseInt(day) <= 9 ? "0" + parseInt(day) : parseInt(day)}`; + } const res = await axios.get(baseUrl, { params }); @@ -167,7 +170,7 @@ const axios = require('axios'); * const yr = 2016; * const result = await sdv.wnba.getStandings(year = yr); */ - getStandings: async function ({year = new Date().getFullYear(), group = 'league'}){ + getStandings: async function ({ year = new Date().getFullYear(), group = 'league' }) { const groupId = group === 'league' ? 1 : 2; const baseUrl = `https://site.web.api.espn.com/apis/v2/sports/basketball/wnba/standings`; const params = { @@ -192,7 +195,7 @@ const axios = require('axios'); * @example * const result = await sdv.wnba.getTeamList(); */ - getTeamList: async function ({}){ + getTeamList: async function ({ }) { const baseUrl = 'http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/teams'; const params = { limit: 1000 @@ -213,7 +216,7 @@ const axios = require('axios'); * const teamId = 16; * const result = await sdv.wnba.getTeamInfo(teamId); */ - getTeamInfo: async function (id){ + getTeamInfo: async function (id) { const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/teams/${id}`; const res = await axios.get(baseUrl); @@ -230,7 +233,7 @@ const axios = require('axios'); * const teamId = 16; * const result = await sdv.wnba.getTeamPlayers(teamId); */ - getTeamPlayers: async function (id){ + getTeamPlayers: async function (id) { const baseUrl = `http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/teams/${id}`; const params = { enable: "roster" diff --git a/docs/docs/tnns.md b/docs/docs/tnns.md new file mode 100644 index 0000000..479abb1 --- /dev/null +++ b/docs/docs/tnns.md @@ -0,0 +1,27 @@ + + +## tnns : object +Operations for Tennis. + +**Kind**: global namespace + + +### tnns.getScoreboard(league, year, month, day) ⇒ +Gets the scoreboard data for a specified date and league if available. + +**Kind**: static method of [tnns](#tnns) +**Returns**: json + +| Param | Type | Description | +| --- | --- | --- | +| league | string | Tennis league desired. Default 'atp' Acceptable values: ['atp', 'wta'] | +| year | \* | Year (YYYY) | +| month | \* | Month (MM) | +| day | \* | Day (DD) | + +**Example** +```js +const result = await sdv.tnns.getScoreboard({ +league = 'wta', year = 2023, month = 06, day = 20 +}) +``` diff --git a/package-lock.json b/package-lock.json index 5d22c25..3de43ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,8 @@ "docdash": "latest", "jsdoc": "^4.0.2", "jsdoc-to-markdown": "^8.0.0", - "mocha": "^9.2.1", + "mocha": "^9.2.2", + "should": "^13.2.3", "underscore": ">=1.12.1" } }, @@ -2039,6 +2040,60 @@ "randombytes": "^2.1.0" } }, + "node_modules/should": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz", + "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==", + "dev": true, + "dependencies": { + "should-equal": "^2.0.0", + "should-format": "^3.0.3", + "should-type": "^1.4.0", + "should-type-adaptors": "^1.0.1", + "should-util": "^1.0.0" + } + }, + "node_modules/should-equal": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz", + "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==", + "dev": true, + "dependencies": { + "should-type": "^1.4.0" + } + }, + "node_modules/should-format": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", + "integrity": "sha512-hZ58adtulAk0gKtua7QxevgUaXTTXxIi8t41L3zo9AHvjXO1/7sdLECuHeIN2SRtYXpNkmhoUP2pdeWgricQ+Q==", + "dev": true, + "dependencies": { + "should-type": "^1.3.0", + "should-type-adaptors": "^1.0.1" + } + }, + "node_modules/should-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "integrity": "sha512-MdAsTu3n25yDbIe1NeN69G4n6mUnJGtSJHygX3+oN0ZbO3DTiATnf7XnYJdGT42JCXurTb1JI0qOBR65shvhPQ==", + "dev": true + }, + "node_modules/should-type-adaptors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz", + "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==", + "dev": true, + "dependencies": { + "should-type": "^1.3.0", + "should-util": "^1.0.0" + } + }, + "node_modules/should-util": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.1.tgz", + "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==", + "dev": true + }, "node_modules/sort-array": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/sort-array/-/sort-array-4.1.5.tgz", diff --git a/package.json b/package.json index 84dd4a3..6a7870c 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "docdash": "latest", "jsdoc": "^4.0.2", "jsdoc-to-markdown": "^8.0.0", - "mocha": "^9.2.1", + "mocha": "^9.2.2", + "should": "^13.2.3", "underscore": ">=1.12.1" }, "scripts": { @@ -35,9 +36,10 @@ "md-ncaa": "jsdoc2md app/services/ncaa.service.js > docs/docs/ncaa.md", "md-nfl": "jsdoc2md app/services/nfl.service.js > docs/docs/nfl.md", "md-nhl": "jsdoc2md app/services/nhl.service.js > docs/docs/nhl.md", + "md-tnns": "jsdoc2md app/services/tnns.service.js > docs/docs/tnns.md", "md-wbb": "jsdoc2md app/services/wbb.service.js > docs/docs/wbb.md", "md-wnba": "jsdoc2md app/services/wnba.service.js > docs/docs/wnba.md", - "md-all": "npm run md-cfb && npm run md-mbb && npm run md-nba && npm run md-ncaa && npm run md-nfl && npm run md-nhl && npm run md-wbb && npm run md-wnba && npm run md-mlb" + "md-all": "npm run md-cfb && npm run md-mbb && npm run md-nba && npm run md-ncaa && npm run md-nfl && npm run md-nhl && npm run md-wbb && npm run md-wnba && npm run md-mlb && npm run md-tnns" }, "repository": { "type": "git", diff --git a/rankings.json b/rankings.json new file mode 100644 index 0000000..b7f47dd --- /dev/null +++ b/rankings.json @@ -0,0 +1 @@ +"\n\t\n\t\n\t\n\t\t\n\n\n\n\n2022 NCAA College Football Polls and Rankings for Week 16 - ESPN\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\n\t\n\t\t\n\t \n\t\t\n\t\n\n\n\n\n\n\n\n\t\n\n\n\n\n\n\t\t\t\n\t\t\t\n\t\t\t\n\n\n\n\t\n\n\t\n\t\t
\n\t\t\n\t\t\n\n\t\t\n\n\t\t
\n\n
\n \n\n\n
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\n
\n \n \n
\n
\n \n
\n \n
\n \n \n
\n\n \n
\n \n
    \n
    \n
    \n\n
    \n \n
    \n \n \n
    \n\n \n
    \n \n
      \n
      \n
      \n\n \n\n
      \n
      \n \n
        \n
        \n
        \n\n \n\n
        \n\n
        <
        \n
        \n
        >
        \n
        \n
          \n
          \n
          \n
          \n
          \n\t\t\t\t\n\t\t\t\t\n
          \n
          \n\t
          \n\t\tMenu

          ESPN

          • \n\n
            \n\t\n\t
            \n\t\t\n\t
            \n
          • scores
          \n\t
          \n\t\n\n\n\n\n\n\n\n\n\n
          \n\t\t\t
          \n\n\n
          \n\n
          \n\n\t\t\t\t
          \n\n \t
          \n\n
          \n \n\n\t\t\t\t\t\n\n\n
          \n\n \n\n
          \n\t
          \n\t\t

          2022 College Football Rankings - Postseason

          \n\n\t\t\n\t
          \n\n\t
          \n\t\t\n\t
          \n\n\n\n\t\t\t\n\t\t\t
          \n\t\t\t\t
          \n\t\t\t\t\t\n\t\t\t\t
          \n\n\t\t\t\t
          \n\t\t\t\t\t\n\t\t\t\t\t
            \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2022
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2021
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2020
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2019
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2018
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2017
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2016
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2015
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2014
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2013
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2012
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2011
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2010
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2009
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2008
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2007
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2006
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2005
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2004
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2003
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • 2002
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
          \n\t\t\t\t
          \n\t\t\t\t
          \n\n\t\t\t\t
          \n\t\t\t\t\t\n\t\t\t\t\t
            \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Preseason
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 2
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 3
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 4
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 5
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 6
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 7
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 8
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 9
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 10
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 11
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 12
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 13
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 14
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Week 15
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          • Final Rankings
          • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
          \n\t\t\t\t
          \n\n\t\t\t\t
          \n\n\t\t\t
          \n\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t
          \n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
          \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          \n\t\t\t\t\t\t\t\t\t

          AP Top 25

          RKTeamRecPtsTrend
          1GeorgiaUGA(63)15-01575
          2TCUTCU13-21484
          3MichiganMICH13-11438
          4Ohio StateOSU11-21394
          5AlabamaALA11-21303
          6TennesseeTENN11-21294
          7Penn StatePSU11-21200
          8WashingtonWASH11-21097
          9TulaneTULN12-21025
          10UtahUTAH10-4876
          11Florida StateFSU10-3814
          12USCUSC11-3795
          13ClemsonCLEM11-3791
          14Kansas StateKSU10-4784
          15OregonORE10-3758
          16LSULSU10-4757
          17Oregon StateORST10-3742
          18Notre DameND9-4535
          19TroyTROY12-2322
          20Mississippi StateMSST9-4320
          21UCLAUCLA9-4243
          22PittsburghPITT9-4233NR
          23South CarolinaSC8-5180
          24Fresno StateFRES10-4164NR
          25TexasTEX8-595
          Complete Rankings

          Dropped from rankings: UTSA 22, NC State 25

          Others receiving votes: Duke 49, UTSA 45, Air Force 40, Boise State 38, Minnesota 35, Texas Tech 19, North Carolina 8, NC State 6, Iowa 4, Purdue 3, Louisville 3, Marshall 2, Maryland 2, Cincinnati 1, Illinois 1

          \n\t\t\t\t\t\t\t\t
          \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
          \n\t\t\t\t\t\t\t\t\t

          AFCA Coaches Poll

          RKTeamRecPtsTrend
          1GeorgiaUGA(63)15-01575
          2TCUTCU13-21482
          3MichiganMICH13-11423
          4Ohio StateOSU11-21404
          5AlabamaALA11-21329
          6TennesseeTENN11-21273
          7Penn StatePSU11-21199
          8WashingtonWASH11-21091
          9TulaneTULN12-2981
          10Florida StateFSU10-3926
          11UtahUTAH10-4878
          12ClemsonCLEM11-3839
          13USCUSC11-3829
          14Kansas StateKSU10-4769
          15LSULSU10-4766
          16OregonORE10-3708
          17Oregon StateORST10-3690
          18Notre DameND9-4498
          19Mississippi StateMSST9-4364
          20TroyTROY12-2314
          21UCLAUCLA9-4238
          22PittsburghPITT9-4193NR
          23South CarolinaSC8-5164
          24Fresno StateFRES10-4134NR
          25TexasTEX8-569
          Complete Rankings

          Dropped from rankings: UTSA 22, North Carolina 25

          Others receiving votes: UTSA 68, Minnesota 57, Air Force 50, Duke 47, North Carolina 35, Boise State 22, Texas Tech 13, Iowa 9, South Alabama 9, Ohio 6, Wake Forest 6, Maryland 4, Cincinnati 3, BYU 3, Louisville 3, UCF 2, Purdue 1, Ole Miss 1

          \n\t\t\t\t\t\t\t\t
          \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
          \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
          \n\t\t\t\t\n\t\t\t\n\n\t
          \n\n
          \n
          \n \n
          \n
          \n

          College Football News

          \n
          \n \n \n \n \n
          \n \n
          \n\n\n\n \n
          \n\n \n\n
          \n
          \n
          \n\t\t\n\n\n\n\t\t\n\n\t\t\n\t\t\t\n\t\t\n\t\n\n\t\n\n\n\n\n\t\t\t\n\t\t\t\n\n\t\n\t\n\n\t\n\n\n \n\n\t\t\n
          \n \n\n\n\t\n" \ No newline at end of file diff --git a/test/cfb.test.js b/test/cfb.test.js new file mode 100644 index 0000000..9c467f3 --- /dev/null +++ b/test/cfb.test.js @@ -0,0 +1,241 @@ +'use strict'; +const should = require('should'); +const app = require('../app/app'); +const fs = require('fs'); + +describe('CFB Games', () => { + var gameId = 401256194; + + it('should populate play by play data for the given game id', async () => { + const data = await app.cfb.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }) + + it('should return a promise for play by play data for the given game id', async () => { + const data = await app.cfb.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate box score data for the given game id', async () => { + const data = await app.cfb.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).have.property('id'); + should(data).not.be.empty; + + }); + + it('should return a promise for box score data for the given game id', async () => { + const data = await app.cfb.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + should(data).have.property('id'); + + }); + + it('should return a promise for game summary data for the given game id', async () => { + const data = await app.cfb.getSummary(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for game picks data for the given game id', async () => { + const data = await app.cfb.getPicks(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('CFB Rankings', () => { + it('should populate rankings for the current week and year', async () => { + const data = await app.cfb.getRankings({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate rankings for the given week and year', async () => { + const data = await app.cfb.getRankings({ + year: 2020, + week: 9 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for rankings for the current week and year', async () => { + const data = await app.cfb.getRankings({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for rankings for the given week and year', async () => { + const data = await app.cfb.getRankings({ + year: 2020, + week: 9 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('CFB Scoreboard', () => { + + it('should populate scoreboard data for the current week and year', async () => { + const data = await app.cfb.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate scoreboard data for the given week and year', async () => { + const data = await app.cfb.getScoreboard({ + year: 2021, + month: 10, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the current week and year', async () => { + const data = await app.cfb.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the given week and year', async () => { + const data = await app.cfb.getScoreboard({ + year: 2021, + month: 10, + day: 15 + }) + + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('CFB Standings', () => { + + it('should populate standings for the given year', async () => { + const data = await app.cfb.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for standings for the given year', async () => { + const data = await app.cfb.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); +describe('CFB Teams', () => { + + it('should populate a teams list', async () => { + const data = await app.cfb.getTeamList({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for teams for the given team id', async () => { + const data = await app.cfb.getTeamInfo(52) + + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for team players for the given team id', async () => { + const data = await app.cfb.getTeamPlayers(52) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); +describe('CFB Recruiting', () => { + + it('should return a promise for a list of individual rankings for the given year', async () => { + const data = await app.cfb.getPlayerRankings({ + year: 2021 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for a list of individual rankings for the given year and position', async () => { + const data = await app.cfb.getPlayerRankings({ + year: 2021, + position: "C" + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for a list of individual rankings for the given year and group', async () => { + const data = await app.cfb.getPlayerRankings({ + year: 2021, + group: "JuniorCollege" + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for a list of school rankings for the given year', async () => { + const data = await app.cfb.getSchoolRankings(2021) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for a school\'s commit list for a given year', async () => { + const data = await app.cfb.getSchoolCommits('floridastate', 2021) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + }); +}); \ No newline at end of file diff --git a/test/mbb.test.js b/test/mbb.test.js new file mode 100644 index 0000000..7611fa5 --- /dev/null +++ b/test/mbb.test.js @@ -0,0 +1,239 @@ +'use strict'; +const should = require('should'); +const app = require('../app/app'); + +describe('MBB Games', () => { + var gameId = 401260281; + + it('should populate play by play data for the given game id', async () => { + const data = await app.mbb.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }) + + it('should return a promise for play by play data for the given game id', async () => { + const data = await app.mbb.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate box score data for the given game id', async () => { + const data = await app.mbb.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).have.property('id'); + should(data).not.be.empty; + + }); + + it('should return a promise for box score data for the given game id', async () => { + const data = await app.mbb.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + should(data).have.property('id'); + + }); + + it('should return a promise for game summary data for the given game id', async () => { + const data = await app.mbb.getSummary(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for game picks data for the given game id', async () => { + const data = await app.mbb.getPicks(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('MBB Rankings', () => { + it('should populate rankings for the current week and year', async () => { + const data = await app.mbb.getRankings({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate rankings for the given week and year', async () => { + const data = await app.mbb.getRankings({ + year: 2020, + week: 9 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for rankings for the current week and year', async () => { + const data = await app.mbb.getRankings({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for rankings for the given week and year', async () => { + const data = await app.mbb.getRankings({ + year: 2020, + week: 9 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('MBB Scoreboard', () => { + + it('should populate scoreboard data for the current week and year', async () => { + const data = await app.mbb.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate scoreboard data for the given week and year', async () => { + const data = await app.mbb.getScoreboard({ + year: 2021, + month: 2, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the current week and year', async () => { + const data = await app.mbb.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the given week and year', async () => { + const data = await app.mbb.getScoreboard({ + year: 2021, + month: 2, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('MBB Standings', () => { + + it('should populate standings for the given year', async () => { + const data = await app.mbb.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for standings for the given year', async () => { + const data = await app.mbb.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); +describe('MBB Teams', () => { + + it('should populate a teams list', async () => { + const data = await app.mbb.getTeamList({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for teams for the given team id', async () => { + const data = await app.mbb.getTeamInfo(52) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for team players for the given team id', async () => { + const data = await app.mbb.getTeamPlayers(52) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); +describe('MBB Recruiting', () => { + + it('should return a promise for a list of individual rankings for the given year', async () => { + const data = await app.mbb.getPlayerRankings({ + year: 2021 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for a list of individual rankings for the given year and position', async () => { + const data = await app.mbb.getPlayerRankings({ + year: 2021, + position: "C" + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for a list of individual rankings for the given year and group', async () => { + const data = await app.mbb.getPlayerRankings({ + year: 2021, + group: "JuniorCollege" + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for a list of school rankings for the given year', async () => { + const data = await app.mbb.getSchoolRankings(2021) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for a school\'s commit list for a given year', async () => { + const data = await app.mbb.getSchoolCommits('floridastate', 2021) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); \ No newline at end of file diff --git a/test/mlb.test.js b/test/mlb.test.js new file mode 100644 index 0000000..6eb0a7a --- /dev/null +++ b/test/mlb.test.js @@ -0,0 +1,157 @@ +'use strict'; +const should = require('should'); +const app = require('../app/app'); + +describe('MLB Games', () => { + + var gameId = 401472105; + + it('should populate play by play data for the given game id', async () => { + const data = await app.mlb.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for play by play data for the given game id', async () => { + const data = await app.mlb.getPlayByPlay(gameId) + + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate box score data for the given game id', async () => { + const data = await app.mlb.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).have.property('id'); + should(data).not.be.empty; + + }); + + it('should return a promise for box score data for the given game id', async () => { + const data = await app.mlb.getBoxScore(gameId) + + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + should(data).have.property('id'); + + }); + + it('should return a promise for game summary data for the given game id', async () => { + const data = await app.mlb.getSummary(gameId) + + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for game picks data for the given game id', async () => { + const data = await app.mlb.getPicks(gameId) + + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + + +describe('MLB Scoreboard', () => { + + it('should populate scoreboard data for the current week and year', async () => { + const data = await app.mlb.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate scoreboard data for the given week and year', async () => { + const data = await app.mlb.getScoreboard({ + year: 2021, + month: 12, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the current week and year', async () => { + const data = await app.mlb.getScoreboard({}) + + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the given week and year', async () => { + const data = await app.mlb.getScoreboard({ + year: 2021, + month: 12, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('MLB Standings', () => { + + it('should populate standings for the given year', async () => { + const data = await app.mlb.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for standings for the given year', async () => { + const data = await app.mlb.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('MLB Teams', () => { + + it('should populate a teams list', async () => { + const data = await app.mlb.getTeamList({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for teams for the given team id', async () => { + const data = await app.mlb.getTeamInfo(16) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for team players for the given team id', async () => { + const data = await app.mlb.getTeamPlayers(16) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); \ No newline at end of file diff --git a/test/nba.test.js b/test/nba.test.js new file mode 100644 index 0000000..4f82d8c --- /dev/null +++ b/test/nba.test.js @@ -0,0 +1,151 @@ +'use strict'; +const should = require('should'); +const app = require('../app/app'); + +describe('NBA Games', () => { + + var gameId = 401283399; + + it('should populate play by play data for the given game id', async () => { + const data = await app.nba.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for play by play data for the given game id', async () => { + const data = await app.nba.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate box score data for the given game id', async () => { + const data = await app.nba.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).have.property('id'); + should(data).not.be.empty; + + }); + + it('should return a promise for box score data for the given game id', async () => { + const data = await app.nba.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + should(data).have.property('id'); + + }); + + it('should return a promise for game summary data for the given game id', async () => { + const data = await app.nba.getSummary(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for game picks data for the given game id', async () => { + const data = await app.nba.getPicks(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('NBA Scoreboard', () => { + + it('should populate scoreboard data for the current week and year', async () => { + const data = await app.nba.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate scoreboard data for the given week and year', async () => { + const data = await app.nba.getScoreboard({ + year: 2021, + month: 2, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the current week and year', async () => { + const data = await app.nba.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the given week and year', async () => { + const data = await app.nba.getScoreboard({ + year: 2021, + month: 2, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('NBA Standings', () => { + + it('should populate standings for the given year', async () => { + const data = await app.nba.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for standings for the given year', async () => { + const data = await app.nba.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('NBA Teams', () => { + + it('should populate a teams list', async () => { + const data = await app.nba.getTeamList({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for teams for the given team id', async () => { + const data = await app.nba.getTeamInfo(16) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for team players for the given team id', async () => { + const data = await app.nba.getTeamPlayers(16) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); \ No newline at end of file diff --git a/test/ncaa.test.js b/test/ncaa.test.js new file mode 100644 index 0000000..68d8829 --- /dev/null +++ b/test/ncaa.test.js @@ -0,0 +1,60 @@ +'use strict'; +const should = require('should'); +const app = require('../app/app'); + +describe('NCAA Games', () => { + + var game = 5764053; + it('should return a promise for ncaa game information for a given game', async () => { + const data = await app.ncaa.getInfo(game) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + it('should return a promise for ncaa game box score for a given game', async () => { + const data = await app.ncaa.getBoxScore(game) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + it('should return a promise for ncaa game play-by-play for a given game', async () => { + const data = await app.ncaa.getPlayByPlay(game) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + it('should return a promise for ncaa game team stats for a given game', async () => { + const data = await app.ncaa.getTeamStats(game) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + it('should return a promise for ncaa game scoring summary for a given game', async () => { + const data = await app.ncaa.getScoringSummary(game) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('NCAA Scoreboard', () => { + + it('should return a promise for ncaa scoreboard data for a given date', async () => { + const data = await app.ncaa.getScoreboard({ + sport: 'basketball-men', + division: 'd1', + year: 2021, + month: 2, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); \ No newline at end of file diff --git a/test/nfl.test.js b/test/nfl.test.js new file mode 100644 index 0000000..e39c853 --- /dev/null +++ b/test/nfl.test.js @@ -0,0 +1,156 @@ +'use strict'; +const should = require('should'); +const app = require('../app/app'); + +describe('NFL Games', () => { + + var gameId = 401220403; + + it('should populate play by play data for the given game id', async () => { + const data = await app.nfl.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for play by play data for the given game id', async () => { + const data = await app.nfl.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate box score data for the given game id', async () => { + const data = await app.nfl.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).have.property('id'); + should(data).not.be.empty; + + }); + + it('should return a promise for box score data for the given game id', async () => { + const data = await app.nfl.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + should(data).have.property('id'); + + }); + + it('should return a promise for game summary data for the given game id', async () => { + const data = await app.nfl.getSummary(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for game picks data for the given game id', async () => { + const data = await app.nfl.getPicks(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + + +describe('NFL Scoreboard', () => { + + it('should populate scoreboard data for the current week and year', async () => { + const data = await app.nfl.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate scoreboard data for the given week and year', async () => { + const data = await app.nfl.getScoreboard({ + year: 2021, + month: 12, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the current week and year', async () => { + const data = await app.nfl.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the given week and year', async () => { + const data = await app.nfl.getScoreboard({ + year: 2021, + month: 12, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('NFL Standings', () => { + + it('should populate standings for the given year', async () => { + const data = await app.nfl.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for standings for the given year', async () => { + const data = await app.nfl.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('NFL Teams', () => { + + it('should populate a teams list', async () => { + const data = await app.nfl.getTeamList({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for teams for the given team id', async () => { + const data = await app.nfl.getTeamInfo({ + id: 16 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for team players for the given team id', async () => { + const data = await app.nfl.getTeamPlayers({ + id: 16 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); diff --git a/test/nhl.test.js b/test/nhl.test.js new file mode 100644 index 0000000..184e57e --- /dev/null +++ b/test/nhl.test.js @@ -0,0 +1,152 @@ +'use strict'; +const should = require('should'); +const app = require('../app/app'); + +describe('NHL Games', () => { + + var gameId = 401272446; + + it('should populate play by play data for the given game id', async () => { + const data = await app.nhl.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for play by play data for the given game id', async () => { + const data = await app.nhl.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate box score data for the given game id', async () => { + const data = await app.nhl.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).have.property('id'); + should(data).not.be.empty; + + }); + + it('should return a promise for box score data for the given game id', async () => { + const data = await app.nhl.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + should(data).have.property('id'); + + }); + + it('should return a promise for game summary data for the given game id', async () => { + const data = await app.nhl.getSummary(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for game picks data for the given game id', async () => { + const data = await app.nhl.getPicks(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + + +describe('NHL Scoreboard', () => { + + it('should populate scoreboard data for the current week and year', async () => { + const data = await app.nhl.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate scoreboard data for the given week and year', async () => { + const data = await app.nhl.getScoreboard({ + year: 2021, + month: 2, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the current week and year', async () => { + const data = await app.nhl.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the given week and year', async () => { + const data = await app.nhl.getScoreboard({ + year: 2021, + month: 2, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('NHL Standings', () => { + + it('should populate standings for the given year', async () => { + const data = await app.nhl.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for standings for the given year', async () => { + const data = await app.nhl.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('NHL Teams', () => { + + it('should populate a teams list', async () => { + const data = await app.nhl.getTeamList({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for teams for the given team id', async () => { + const data = await app.nhl.getTeamInfo(16) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for team players for the given team id', async () => { + const data = await app.nhl.getTeamPlayers(16) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f80892d..0000000 --- a/test/test.js +++ /dev/null @@ -1,1566 +0,0 @@ -var chai = require('chai'); -var app = require('../app/app'); -var should = chai.should(); - -describe('MBB Games', function() { - var gameId = 401260281; - - it('should populate play by play data for the given game id', function() { - app.mbb.getPlayByPlay(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }) - - it('should return a promise for play by play data for the given game id', function() { - app.mbb.getPlayByPlay(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate box score data for the given game id', function() { - app.mbb.getBoxScore(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.id.should.exist; - data.should.not.be.empty; - }); - }); - - it('should return a promise for box score data for the given game id', function() { - app.mbb.getBoxScore(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - data.id.should.exist; - }); - }); - - it('should return a promise for game summary data for the given game id', function() { - app.mbb.getSummary(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for game picks data for the given game id', function() { - app.mbb.getPicks(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('MBB Rankings', () => { - it('should populate rankings for the current week and year', function() { - app.mbb.getRankings({}).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate rankings for the given week and year', function() { - app.mbb.getRankings({ - year: 2020, - week: 9 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for rankings for the current week and year', function() { - app.mbb.getRankings({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for rankings for the given week and year', function() { - app.mbb.getRankings({ - year: 2020, - week: 9 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('MBB Scoreboard', () => { - - it('should populate scoreboard data for the current week and year', function() { - app.mbb.getScoreboard({}).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate scoreboard data for the given week and year', function() { - app.mbb.getScoreboard({ - year: 2021, - month: 2, - day: 15 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the current week and year', function() { - app.mbb.getScoreboard({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the given week and year', function() { - app.mbb.getScoreboard({ - year: 2021, - month: 2, - day: 15 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('MBB Standings', () => { - - it('should populate standings for the given year', function() { - app.mbb.getStandings({ - year: 2020 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for standings for the given year', function() { - app.mbb.getStandings({ - year: 2020 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); -describe('MBB Teams', () => { - - it('should populate a teams list', function() { - app.mbb.getTeamList({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for teams for the given team id', function() { - app.mbb.getTeamInfo({ - id: 52 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for team players for the given team id', function() { - app.mbb.getTeamPlayers({ - id: 52 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); -describe('MBB Recruiting', () => { - - it('should return a promise for a list of individual rankings for the given year', function() { - app.mbb.getPlayerRankings({ - year: 2021 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }) - }); - - it('should return a promise for a list of individual rankings for the given year and position', function() { - app.mbb.getPlayerRankings({ - year: 2021, - position: "C" - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }) - }); - - it('should return a promise for a list of individual rankings for the given year and group', function() { - app.mbb.getPlayerRankings({ - year: 2021, - group: "JuniorCollege" - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }) - }); - - it('should return a promise for a list of school rankings for the given year', function() { - app.mbb.getSchoolRankings(2021) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }) - }); - - it('should return a promise for a school\'s commit list for a given year', function() { - app.mbb.getSchoolCommits('floridastate', 2021) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }) - }); -}); -describe('WBB Games', () => { - var gameId = 401264909; - - it('should populate play by play data for the given game id', function() { - app.wbb.getPlayByPlay(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for play by play data for the given game id', function() { - app.wbb.getPlayByPlay(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate box score data for the given game id', function() { - app.wbb.getBoxScore(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.id.should.exist; - data.should.not.be.empty; - }); - }); - - it('should return a promise for box score data for the given game id', function() { - app.wbb.getBoxScore(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - data.id.should.exist; - }); - }); - - it('should return a promise for game summary data for the given game id', function() { - app.wbb.getSummary(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('WBB Rankings', () => { - - it('should populate rankings for the current week and year', function() { - app.wbb.getRankings({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate rankings for the given week and year', function() { - app.wbb.getRankings({ - year: 2020, - week: 9 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for rankings for the current week and year', function() { - app.wbb.getRankings({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty;}); - }); - - it('should return a promise for rankings for the given week and year', function() { - app.wbb.getRankings({ - year: 2020, - week: 9 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty;}); - }); -}); - -describe('WBB Scoreboard', () => { - - it('should populate scoreboard data for the current week and year', function() { - app.wbb.getScoreboard({}).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate scoreboard data for the given week and year', function() { - app.wbb.getScoreboard({ - year: 2021, - month: 2, - day: 15 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the current week and year', function() { - app.wbb.getScoreboard({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty;}); - }); - - it('should return a promise for scoreboard data for the given week and year', function() { - app.wbb.getScoreboard({ - year: 2021, - month: 2, - day: 15 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty;}); - }); -}); - -describe('WBB Standings', () => { - - it('should populate standings for the given year', function() { - app.wbb.getStandings({ - year: 2020 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for standings for the given year', function() { - app.wbb.getStandings({ - year: 2020 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty;}); - }); -}); -describe('WBB Teams', () => { - - it('should populate a teams list', function() { - app.wbb.getTeamList({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for teams for the given team id', function() { - app.wbb.getTeamInfo({ - id: 52 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for team players for the given team id', function() { - app.wbb.getTeamPlayers({ - id: 52 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); -describe('NCAA Games', () => { - - var game = 5764053; - it('should return a promise for ncaa game information for a given game', function() { - app.ncaa.getInfo(game) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; }) - }); - it('should return a promise for ncaa game box score for a given game', function() { - app.ncaa.getBoxScore(game) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; }) - }); - it('should return a promise for ncaa game play-by-play for a given game', function() { - app.ncaa.getPlayByPlay(game) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; }) - }); - it('should return a promise for ncaa game team stats for a given game', function() { - app.ncaa.getTeamStats(game) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; }) - }); - it('should return a promise for ncaa game scoring summary for a given game', function() { - app.ncaa.getScoringSummary(game) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; }) - }); -}); - -describe('NCAA Scoreboard', () => { - - it('should return a promise for ncaa scoreboard data for a given date', function() { - app.ncaa.getScoreboard({ - sport: 'basketball-men', - division: 'd1', - year: 2021, - month: 2, - day: 15 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty;}); - }); -}); -describe('NBA Games', () => { - - var gameId = 401283399; - - it('should populate play by play data for the given game id', function() { - app.nba.getPlayByPlay(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for play by play data for the given game id', function() { - app.nba.getPlayByPlay(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty;}); - }); - - it('should populate box score data for the given game id', function() { - app.nba.getBoxScore(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.id.should.exist; - data.should.not.be.empty; - }); - }); - - it('should return a promise for box score data for the given game id', function() { - app.nba.getBoxScore(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; data.id.should.exist; - }); - }); - - it('should return a promise for game summary data for the given game id', function() { - app.nba.getSummary(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty;}); - }); - - it('should return a promise for game picks data for the given game id', function() { - app.nba.getPicks(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('NBA Scoreboard', () => { - - it('should populate scoreboard data for the current week and year', function() { - app.nba.getScoreboard({}).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate scoreboard data for the given week and year', function() { - app.nba.getScoreboard({ - year: 2021, - month: 2, - day: 15 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the current week and year', function() { - app.nba.getScoreboard({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty;}); - }); - - it('should return a promise for scoreboard data for the given week and year', function() { - app.nba.getScoreboard({ - year: 2021, - month: 2, - day: 15 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty;}); - }); -}); - -describe('NBA Standings', () => { - - it('should populate standings for the given year', function() { - app.nba.getStandings({ - year: 2020 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for standings for the given year', function() { - app.nba.getStandings({ - year: 2020 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('NBA Teams', () => { - - it('should populate a teams list', function() { - app.nba.getTeamList({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for teams for the given team id', function() { - app.nba.getTeamInfo({ - id: 16 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for team players for the given team id', function() { - app.nba.getTeamPlayers({ - id: 16 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('WNBA Games', () => { - - var gameId = 401244185; - - it('should populate play by play data for the given game id', function() { - app.wnba.getPlayByPlay(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for play by play data for the given game id', function() { - app.wnba.getPlayByPlay(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate box score data for the given game id', function() { - app.wnba.getBoxScore(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.id.should.exist; - data.should.not.be.empty; - }); - }); - - it('should return a promise for box score data for the given game id', function() { - app.wnba.getBoxScore(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - data.id.should.exist; - }); - }); - - it('should return a promise for game summary data for the given game id', function() { - app.wnba.getSummary(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - - -describe('WNBA Scoreboard', () => { - - it('should populate scoreboard data for the current week and year', function() { - app.wnba.getScoreboard({}).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate scoreboard data for the given week and year', function() { - app.wnba.getScoreboard({ - year: 2021, - month: 2, - day: 15 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the current week and year', function() { - app.wnba.getScoreboard({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the given week and year', function() { - app.wnba.getScoreboard({ - year: 2021, - month: 2, - day: 15 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('WNBA Standings', () => { - - it('should populate standings for the given year', function() { - app.wnba.getStandings({ - year: 2020 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for standings for the given year', function() { - app.wnba.getStandings({ - year: 2020 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('WNBA Teams', () => { - - it('should populate a teams list', function() { - app.wnba.getTeamList({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for teams for the given team id', function() { - app.wnba.getTeamInfo({ - id: 16 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for team players for the given team id', function() { - app.wnba.getTeamPlayers({ - id: 16 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('NHL Games', () => { - - var gameId = 401272446; - - it('should populate play by play data for the given game id', function() { - app.nhl.getPlayByPlay(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for play by play data for the given game id', function() { - app.nhl.getPlayByPlay(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate box score data for the given game id', function() { - app.nhl.getBoxScore(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.id.should.exist; - data.should.not.be.empty; - }); - }); - - it('should return a promise for box score data for the given game id', function() { - app.nhl.getBoxScore(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - data.id.should.exist; - }); - }); - - it('should return a promise for game summary data for the given game id', function() { - app.nhl.getSummary(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for game picks data for the given game id', function() { - app.nhl.getPicks(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - - -describe('NHL Scoreboard', () => { - - it('should populate scoreboard data for the current week and year', function() { - app.nhl.getScoreboard({}).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate scoreboard data for the given week and year', function() { - app.nhl.getScoreboard({ - year: 2021, - month: 2, - day: 15 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the current week and year', function() { - app.nhl.getScoreboard({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the given week and year', function() { - app.nhl.getScoreboard({ - year: 2021, - month: 2, - day: 15 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('NHL Standings', () => { - - it('should populate standings for the given year', function() { - app.nhl.getStandings({ - year: 2020 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for standings for the given year', function() { - app.nhl.getStandings({ - year: 2020 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('NHL Teams', () => { - - it('should populate a teams list', function() { - app.nhl.getTeamList({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for teams for the given team id', function() { - app.nhl.getTeamInfo({ - id: 16 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for team players for the given team id', function() { - app.nhl.getTeamPlayers({ - id: 16 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - - -describe('NFL Games', () => { - - var gameId = 401220403; - - it('should populate play by play data for the given game id', function() { - app.nfl.getPlayByPlay(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for play by play data for the given game id', function() { - app.nfl.getPlayByPlay(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate box score data for the given game id', function() { - app.nfl.getBoxScore(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.id.should.exist; - data.should.not.be.empty; - }); - }); - - it('should return a promise for box score data for the given game id', function() { - app.nfl.getBoxScore(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - data.id.should.exist; - }); - }); - - it('should return a promise for game summary data for the given game id', function() { - app.nfl.getSummary(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for game picks data for the given game id', function() { - app.nfl.getPicks(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - - -describe('NFL Scoreboard', () => { - - it('should populate scoreboard data for the current week and year', function() { - app.nfl.getScoreboard({}).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate scoreboard data for the given week and year', function() { - app.nfl.getScoreboard({ - year: 2021, - month: 12, - day: 15 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the current week and year', function() { - app.nfl.getScoreboard({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the given week and year', function() { - app.nfl.getScoreboard({ - year: 2021, - month: 12, - day: 15 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('NFL Standings', () => { - - it('should populate standings for the given year', function() { - app.nfl.getStandings({ - year: 2020 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for standings for the given year', function() { - app.nfl.getStandings({ - year: 2020 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('NFL Teams', () => { - - it('should populate a teams list', function() { - app.nfl.getTeamList({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for teams for the given team id', function() { - app.nfl.getTeamInfo({ - id: 16 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for team players for the given team id', function() { - app.nfl.getTeamPlayers({ - id: 16 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - - -describe('MLB Games', () => { - - var gameId = 401472105; - - it('should populate play by play data for the given game id', function() { - app.mlb.getPlayByPlay(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for play by play data for the given game id', function() { - app.mlb.getPlayByPlay(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate box score data for the given game id', function() { - app.mlb.getBoxScore(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.id.should.exist; - data.should.not.be.empty; - }); - }); - - it('should return a promise for box score data for the given game id', function() { - app.mlb.getBoxScore(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - data.id.should.exist; - }); - }); - - it('should return a promise for game summary data for the given game id', function() { - app.mlb.getSummary(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for game picks data for the given game id', function() { - app.mlb.getPicks(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - - -describe('MLB Scoreboard', () => { - - it('should populate scoreboard data for the current week and year', function() { - app.mlb.getScoreboard({}).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate scoreboard data for the given week and year', function() { - app.mlb.getScoreboard({ - year: 2021, - month: 12, - day: 15 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the current week and year', function() { - app.mlb.getScoreboard({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the given week and year', function() { - app.mlb.getScoreboard({ - year: 2021, - month: 12, - day: 15 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('MLB Standings', () => { - - it('should populate standings for the given year', function() { - app.mlb.getStandings({ - year: 2020 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for standings for the given year', function() { - app.mlb.getStandings({ - year: 2020 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('MLB Teams', () => { - - it('should populate a teams list', function() { - app.mlb.getTeamList({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for teams for the given team id', function() { - app.mlb.getTeamInfo({ - id: 16 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for team players for the given team id', function() { - app.mlb.getTeamPlayers({ - id: 16 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('CFB Games', function() { - var gameId = 401256194; - - it('should populate play by play data for the given game id', function() { - app.cfb.getPlayByPlay(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }) - - it('should return a promise for play by play data for the given game id', function() { - app.cfb.getPlayByPlay(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate box score data for the given game id', function() { - app.cfb.getBoxScore(gameId).then((data) => { - data.should.exist; - data.should.be.json; - data.id.should.exist; - data.should.not.be.empty; - }); - }); - - it('should return a promise for box score data for the given game id', function() { - app.cfb.getBoxScore(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - data.id.should.exist; - }); - }); - - it('should return a promise for game summary data for the given game id', function() { - app.cfb.getSummary(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for game picks data for the given game id', function() { - app.cfb.getPicks(gameId) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('CFB Rankings', () => { - it('should populate rankings for the current week and year', function() { - app.cfb.getRankings({}).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate rankings for the given week and year', function() { - app.cfb.getRankings({ - year: 2020, - week: 9 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for rankings for the current week and year', function() { - app.cfb.getRankings({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for rankings for the given week and year', function() { - app.cfb.getRankings({ - year: 2020, - week: 9 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('CFB Scoreboard', () => { - - it('should populate scoreboard data for the current week and year', function() { - app.cfb.getScoreboard({}).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should populate scoreboard data for the given week and year', function() { - app.cfb.getScoreboard({ - year: 2021, - month: 10, - day: 15 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the current week and year', function() { - app.cfb.getScoreboard({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for scoreboard data for the given week and year', function() { - app.cfb.getScoreboard({ - year: 2021, - month: 10, - day: 15 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); - -describe('CFB Standings', () => { - - it('should populate standings for the given year', function() { - app.cfb.getStandings({ - year: 2020 - }).then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for standings for the given year', function() { - app.cfb.getStandings({ - year: 2020 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); -describe('CFB Teams', () => { - - it('should populate a teams list', function() { - app.cfb.getTeamList({}) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for teams for the given team id', function() { - app.cfb.getTeamInfo({ - id: 52 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); - - it('should return a promise for team players for the given team id', function() { - app.cfb.getTeamPlayers({ - id: 52 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }); - }); -}); -describe('CFB Recruiting', () => { - - it('should return a promise for a list of individual rankings for the given year', function() { - app.cfb.getPlayerRankings({ - year: 2021 - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }) - }); - - it('should return a promise for a list of individual rankings for the given year and position', function() { - app.cfb.getPlayerRankings({ - year: 2021, - position: "C" - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }) - }); - - it('should return a promise for a list of individual rankings for the given year and group', function() { - app.cfb.getPlayerRankings({ - year: 2021, - group: "JuniorCollege" - }) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }) - }); - - it('should return a promise for a list of school rankings for the given year', function() { - app.cfb.getSchoolRankings(2021) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }) - }); - - it('should return a promise for a school\'s commit list for a given year', function() { - app.cfb.getSchoolCommits('floridastate', 2021) - .then((data) => { - data.should.exist; - data.should.be.json; - data.should.not.be.empty; - }) - }); -}); \ No newline at end of file diff --git a/test/tnns.test.js b/test/tnns.test.js new file mode 100644 index 0000000..8d2d47f --- /dev/null +++ b/test/tnns.test.js @@ -0,0 +1,54 @@ +'use strict'; +const should = require('should'); +const app = require('../app/app'); + + +describe('TNNS Scoreboard', () => { + + it('should populate scoreboard data for the current week and year', async () => { + const data = await app.tnns.getScoreboard({}); + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + it('should populate scoreboard data for the current week and year and league', async () => { + const data = await app.tnns.getScoreboard({ league: "wta" }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate scoreboard data for the given week and year', async () => { + const data = await app.tnns.getScoreboard({ + year: 2021, + month: 2, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the current week and year', async () => { + const data = await app.tnns.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the given week and year', async () => { + const data = await app.tnns.getScoreboard({ + year: 2021, + month: 2, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); \ No newline at end of file diff --git a/test/wbb.test.js b/test/wbb.test.js new file mode 100644 index 0000000..0f97669 --- /dev/null +++ b/test/wbb.test.js @@ -0,0 +1,182 @@ +'use strict'; +const should = require('should'); +const app = require('../app/app'); + +describe('WBB Games', () => { + var gameId = 401264909; + + it('should populate play by play data for the given game id', async () => { + const data = await app.wbb.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for play by play data for the given game id', async () => { + const data = await app.wbb.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate box score data for the given game id', async () => { + const data = await app.wbb.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).have.property('id'); + should(data).not.be.empty; + + }); + + it('should return a promise for box score data for the given game id', async () => { + const data = await app.wbb.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + should(data).have.property('id'); + + }); + + it('should return a promise for game summary data for the given game id', async () => { + const data = await app.wbb.getSummary(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('WBB Rankings', () => { + + it('should populate rankings for the current week and year', async () => { + const data = await app.wbb.getRankings({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate rankings for the given week and year', async () => { + const data = await app.wbb.getRankings({ + year: 2020, + week: 9 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for rankings for the current week and year', async () => { + const data = await app.wbb.getRankings({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for rankings for the given week and year', async () => { + const data = await app.wbb.getRankings({ + year: 2020, + week: 9 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('WBB Scoreboard', () => { + + it('should populate scoreboard data for the current week and year', async () => { + const data = await app.wbb.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate scoreboard data for the given week and year', async () => { + const data = await app.wbb.getScoreboard({ + year: 2021, + month: 2, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the current week and year', async () => { + const data = await app.wbb.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the given week and year', async () => { + const data = await app.wbb.getScoreboard({ + year: 2021, + month: 2, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('WBB Standings', () => { + + it('should populate standings for the given year', async () => { + const data = await app.wbb.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for standings for the given year', async () => { + const data = await app.wbb.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); +describe('WBB Teams', () => { + + it('should populate a teams list', async () => { + const data = await app.wbb.getTeamList({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for teams for the given team id', async () => { + const data = await app.wbb.getTeamInfo(52) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for team players for the given team id', async () => { + const data = await app.wbb.getTeamPlayers(52) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); \ No newline at end of file diff --git a/test/wnba.test.js b/test/wnba.test.js new file mode 100644 index 0000000..056d049 --- /dev/null +++ b/test/wnba.test.js @@ -0,0 +1,144 @@ +'use strict'; +const should = require('should'); +const app = require('../app/app'); + +describe('WNBA Games', () => { + + var gameId = 401244185; + + it('should populate play by play data for the given game id', async () => { + const data = await app.wnba.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for play by play data for the given game id', async () => { + const data = await app.wnba.getPlayByPlay(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate box score data for the given game id', async () => { + const data = await app.wnba.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).have.property('id'); + should(data).not.be.empty; + + }); + + it('should return a promise for box score data for the given game id', async () => { + const data = await app.wnba.getBoxScore(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + should(data).have.property('id'); + + }); + + it('should return a promise for game summary data for the given game id', async () => { + const data = await app.wnba.getSummary(gameId) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + + +describe('WNBA Scoreboard', () => { + + it('should populate scoreboard data for the current week and year', async () => { + const data = await app.wnba.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should populate scoreboard data for the given week and year', async () => { + const data = await app.wnba.getScoreboard({ + year: 2021, + month: 2, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the current week and year', async () => { + const data = await app.wnba.getScoreboard({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for scoreboard data for the given week and year', async () => { + const data = await app.wnba.getScoreboard({ + year: 2021, + month: 2, + day: 15 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('WNBA Standings', () => { + + it('should populate standings for the given year', async () => { + const data = await app.wnba.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for standings for the given year', async () => { + const data = await app.wnba.getStandings({ + year: 2020 + }) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); + +describe('WNBA Teams', () => { + + it('should populate a teams list', async () => { + const data = await app.wnba.getTeamList({}) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for teams for the given team id', async () => { + const data = await app.wnba.getTeamInfo(16) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); + + it('should return a promise for team players for the given team id', async () => { + const data = await app.wnba.getTeamPlayers(16) + should(data).exist; + should(data).be.json; + should(data).not.be.empty; + + }); +}); \ No newline at end of file From d7065051a1b98838e3328e2b30d7699c5c82d15d Mon Sep 17 00:00:00 2001 From: Scott Weaver Date: Tue, 20 Jun 2023 19:18:13 -0500 Subject: [PATCH 2/3] optional: added mochawesome html report --- .gitignore | 3 +- package-lock.json | 258 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 5 +- 3 files changed, 263 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c90199d..e7f2df9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules .vscode -examples \ No newline at end of file +examples +mochawesome-report \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 3de43ae..55aaacf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "jsdoc": "^4.0.2", "jsdoc-to-markdown": "^8.0.0", "mocha": "^9.2.2", + "mochawesome": "^7.1.3", "should": "^13.2.3", "underscore": ">=1.12.1" } @@ -673,6 +674,15 @@ "url": "https://github.com/sponsors/fb55" } }, + "node_modules/dateformat": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", + "integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/debug": { "version": "4.3.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", @@ -895,6 +905,12 @@ "node": ">=6" } }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "dev": true + }, "node_modules/escape-string-regexp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", @@ -1003,6 +1019,20 @@ } } }, + "node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/fs-then-native": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fs-then-native/-/fs-then-native-2.0.0.tgz", @@ -1032,6 +1062,12 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/fsu": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/fsu/-/fsu-1.1.1.tgz", + "integrity": "sha512-xQVsnjJ/5pQtcKh+KjUoZGzVWn4uNkchxTF6Lwjr4Gf7nQr8fmUfhKJ62zE77+xQg9xnxi5KUps7XGs+VC986A==", + "dev": true + }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -1302,6 +1338,12 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -1415,6 +1457,24 @@ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/keyv": { "version": "4.5.2", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz", @@ -1468,6 +1528,30 @@ "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=", "dev": true }, + "node_modules/lodash.isempty": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.isempty/-/lodash.isempty-4.4.0.tgz", + "integrity": "sha512-oKMuF3xEeqDltrGMfDxAPGIVMSSRv8tbRSODbrs4KGsRRLEhrW8N8Rd4DRgB2+621hY8A8XwwrTVhXWpxFvMzg==", + "dev": true + }, + "node_modules/lodash.isfunction": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz", + "integrity": "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw==", + "dev": true + }, + "node_modules/lodash.isobject": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", + "integrity": "sha512-3/Qptq2vr7WeJbB4KHUSKlq8Pl7ASXi3UG6CMbBm8WRtXi8+GHm7mKaU3urfpSEzWe2wCIChs6/sdocUsTKJiA==", + "dev": true + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "dev": true + }, "node_modules/lodash.omit": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.omit/-/lodash.omit-4.5.0.tgz", @@ -1502,6 +1586,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, "node_modules/lowercase-keys": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", @@ -1677,6 +1773,91 @@ "node": ">=10" } }, + "node_modules/mochawesome": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/mochawesome/-/mochawesome-7.1.3.tgz", + "integrity": "sha512-Vkb3jR5GZ1cXohMQQ73H3cZz7RoxGjjUo0G5hu0jLaW+0FdUxUwg3Cj29bqQdh0rFcnyV06pWmqmi5eBPnEuNQ==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2", + "diff": "^5.0.0", + "json-stringify-safe": "^5.0.1", + "lodash.isempty": "^4.4.0", + "lodash.isfunction": "^3.0.9", + "lodash.isobject": "^3.0.2", + "lodash.isstring": "^4.0.1", + "mochawesome-report-generator": "^6.2.0", + "strip-ansi": "^6.0.1", + "uuid": "^8.3.2" + }, + "peerDependencies": { + "mocha": ">=7" + } + }, + "node_modules/mochawesome-report-generator": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/mochawesome-report-generator/-/mochawesome-report-generator-6.2.0.tgz", + "integrity": "sha512-Ghw8JhQFizF0Vjbtp9B0i//+BOkV5OWcQCPpbO0NGOoxV33o+gKDYU0Pr2pGxkIHnqZ+g5mYiXF7GMNgAcDpSg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2", + "dateformat": "^4.5.1", + "escape-html": "^1.0.3", + "fs-extra": "^10.0.0", + "fsu": "^1.1.1", + "lodash.isfunction": "^3.0.9", + "opener": "^1.5.2", + "prop-types": "^15.7.2", + "tcomb": "^3.2.17", + "tcomb-validation": "^3.3.0", + "validator": "^13.6.0", + "yargs": "^17.2.1" + }, + "bin": { + "marge": "bin/cli.js" + } + }, + "node_modules/mochawesome-report-generator/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/mochawesome-report-generator/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/mochawesome-report-generator/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -1732,6 +1913,15 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-get": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/object-get/-/object-get-2.1.1.tgz", @@ -1755,6 +1945,15 @@ "wrappy": "1" } }, + "node_modules/opener": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", + "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", + "dev": true, + "bin": { + "opener": "bin/opener-bin.js" + } + }, "node_modules/p-cancelable": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", @@ -1844,6 +2043,17 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -1873,6 +2083,12 @@ "safe-buffer": "^5.1.0" } }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -2260,6 +2476,21 @@ "node": "*" } }, + "node_modules/tcomb": { + "version": "3.2.29", + "resolved": "https://registry.npmjs.org/tcomb/-/tcomb-3.2.29.tgz", + "integrity": "sha512-di2Hd1DB2Zfw6StGv861JoAF5h/uQVu/QJp2g8KVbtfKnoHdBQl5M32YWq6mnSYBQ1vFFrns5B1haWJL7rKaOQ==", + "dev": true + }, + "node_modules/tcomb-validation": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/tcomb-validation/-/tcomb-validation-3.4.1.tgz", + "integrity": "sha512-urVVMQOma4RXwiVCa2nM2eqrAomHROHvWPuj6UkDGz/eb5kcy0x6P0dVt6kzpUZtYMNoAqJLWmz1BPtxrtjtrA==", + "dev": true, + "dependencies": { + "tcomb": "^3.0.0" + } + }, "node_modules/temp-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/temp-path/-/temp-path-1.0.0.tgz", @@ -2347,6 +2578,33 @@ "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==", "dev": true }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/validator": { + "version": "13.9.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.9.0.tgz", + "integrity": "sha512-B+dGG8U3fdtM0/aNK4/X8CXq/EcxU2WPrPEkJGslb47qyHsxmbggTWK0yEA4qnYVNF+nxNlN88o14hIcPmSIEA==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/walk-back": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/walk-back/-/walk-back-5.1.0.tgz", diff --git a/package.json b/package.json index 6a7870c..cb1c063 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,12 @@ "jsdoc": "^4.0.2", "jsdoc-to-markdown": "^8.0.0", "mocha": "^9.2.2", + "mochawesome": "^7.1.3", "should": "^13.2.3", "underscore": ">=1.12.1" }, "scripts": { - "test": "mocha --timeout 10000", + "test": "mocha --timeout 10000 --reporter mochawesome", "start": "node server.js", "document": "npm run md-all && npm run md-readme && npm run readme", "jsdoc-build": "jsdoc app -r -c conf.json -d docs", @@ -130,4 +131,4 @@ "url": "https://github.com/sportsdataverse/sportsdataverse-js/issues" }, "homepage": "https://js.sportsdataverse.org/" -} +} \ No newline at end of file From b6c0f84c83751165531702a19405e5cc153342ba Mon Sep 17 00:00:00 2001 From: Scott Weaver Date: Thu, 29 Jun 2023 19:49:42 -0500 Subject: [PATCH 3/3] removed test file, renamed tnns to tennis --- app/app.js | 2 +- .../{tnns.service.js => tennis.service.js} | 6 ++--- docs/docs/tennis.md | 27 +++++++++++++++++++ md/README.hbs | 6 +++++ md/intro.hbs | 6 +++++ package.json | 4 +-- rankings.json | 1 - test/{tnns.test.js => tennis.test.js} | 10 +++---- 8 files changed, 50 insertions(+), 12 deletions(-) rename app/services/{tnns.service.js => tennis.service.js} (91%) create mode 100644 docs/docs/tennis.md delete mode 100644 rankings.json rename test/{tnns.test.js => tennis.test.js} (81%) diff --git a/app/app.js b/app/app.js index 32c49f4..716ebc4 100644 --- a/app/app.js +++ b/app/app.js @@ -6,7 +6,7 @@ module.exports.nba = require('./services/nba.service'); module.exports.ncaa = require('./services/ncaa.service'); module.exports.nfl = require('./services/nfl.service'); module.exports.nhl = require('./services/nhl.service'); -module.exports.tnns = require('./services/tnns.service'); +module.exports.tennis = require('./services/tennis.service'); module.exports.wbb = require('./services/wbb.service'); module.exports.wnba = require('./services/wnba.service'); diff --git a/app/services/tnns.service.js b/app/services/tennis.service.js similarity index 91% rename from app/services/tnns.service.js rename to app/services/tennis.service.js index 0666ef3..7f7430c 100644 --- a/app/services/tnns.service.js +++ b/app/services/tennis.service.js @@ -2,12 +2,12 @@ const axios = require('axios'); /** * Operations for Tennis. * - * @namespace tnns + * @namespace tennis */ module.exports = { /** * Gets the scoreboard data for a specified date and league if available. - * @memberOf tnns + * @memberOf tennis * @async * @function * @param {string} league - Tennis league desired. Default 'atp' Acceptable values: @@ -17,7 +17,7 @@ module.exports = { * @param {*} day - Day (DD) * @returns json * @example - * const result = await sdv.tnns.getScoreboard({ + * const result = await sdv.tennis.getScoreboard({ * league = 'wta', year = 2023, month = 06, day = 20 * }) */ diff --git a/docs/docs/tennis.md b/docs/docs/tennis.md new file mode 100644 index 0000000..55aa0a2 --- /dev/null +++ b/docs/docs/tennis.md @@ -0,0 +1,27 @@ + + +## tennis : object +Operations for Tennis. + +**Kind**: global namespace + + +### tennis.getScoreboard(league, year, month, day) ⇒ +Gets the scoreboard data for a specified date and league if available. + +**Kind**: static method of [tennis](#tennis) +**Returns**: json + +| Param | Type | Description | +| --- | --- | --- | +| league | string | Tennis league desired. Default 'atp' Acceptable values: ['atp', 'wta'] | +| year | \* | Year (YYYY) | +| month | \* | Month (MM) | +| day | \* | Day (DD) | + +**Example** +```js +const result = await sdv.tennis.getScoreboard({ +league = 'wta', year = 2023, month = 06, day = 20 +}) +``` diff --git a/md/README.hbs b/md/README.hbs index 7015531..a4a8e74 100644 --- a/md/README.hbs +++ b/md/README.hbs @@ -133,6 +133,12 @@ The following sports are available from ESPN: {{>members~}} {{/namespace}} +{{#namespace name="tennis"}} +{{>body~}} +{{>member-index~}} +{{>members~}} +{{/namespace}} + {{#namespace name="wbb"}} {{>body~}} {{>member-index~}} diff --git a/md/intro.hbs b/md/intro.hbs index 007bd67..bc023ef 100644 --- a/md/intro.hbs +++ b/md/intro.hbs @@ -106,6 +106,12 @@ The following sports are available from ESPN: {{>members~}} {{/namespace}} +{{#namespace name="tennis"}} +{{>body~}} +{{>member-index~}} +{{>members~}} +{{/namespace}} + {{#namespace name="wbb"}} {{>body~}} {{>member-index~}} diff --git a/package.json b/package.json index cb1c063..a250ac0 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,10 @@ "md-ncaa": "jsdoc2md app/services/ncaa.service.js > docs/docs/ncaa.md", "md-nfl": "jsdoc2md app/services/nfl.service.js > docs/docs/nfl.md", "md-nhl": "jsdoc2md app/services/nhl.service.js > docs/docs/nhl.md", - "md-tnns": "jsdoc2md app/services/tnns.service.js > docs/docs/tnns.md", + "md-tennis": "jsdoc2md app/services/tennis.service.js > docs/docs/tennis.md", "md-wbb": "jsdoc2md app/services/wbb.service.js > docs/docs/wbb.md", "md-wnba": "jsdoc2md app/services/wnba.service.js > docs/docs/wnba.md", - "md-all": "npm run md-cfb && npm run md-mbb && npm run md-nba && npm run md-ncaa && npm run md-nfl && npm run md-nhl && npm run md-wbb && npm run md-wnba && npm run md-mlb && npm run md-tnns" + "md-all": "npm run md-cfb && npm run md-mbb && npm run md-nba && npm run md-ncaa && npm run md-nfl && npm run md-nhl && npm run md-wbb && npm run md-wnba && npm run md-mlb && npm run md-tennis" }, "repository": { "type": "git", diff --git a/rankings.json b/rankings.json deleted file mode 100644 index b7f47dd..0000000 --- a/rankings.json +++ /dev/null @@ -1 +0,0 @@ -"\n\t\n\t\n\t\n\t\t\n\n\n\n\n2022 NCAA College Football Polls and Rankings for Week 16 - ESPN\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\n\t\n\t\t\n\t \n\t\t\n\t\n\n\n\n\n\n\n\n\t\n\n\n\n\n\n\t\t\t\n\t\t\t\n\t\t\t\n\n\n\n\t\n\n\t\n\t\t
          \n\t\t\n\t\t\n\n\t\t\n\n\t\t
          \n\n
          \n \n\n\n
          \n\t\t\t
          \n\t\t\t\t\n\t\t\t\t\t\n\n
          \n \n \n
          \n
          \n \n
          \n \n
          \n \n \n
          \n\n \n
          \n \n
            \n
            \n
            \n\n
            \n \n
            \n \n \n
            \n\n \n
            \n \n
              \n
              \n
              \n\n \n\n
              \n
              \n \n
                \n
                \n
                \n\n \n\n
                \n\n
                <
                \n
                \n
                >
                \n
                \n
                  \n
                  \n
                  \n
                  \n
                  \n\t\t\t\t\n\t\t\t\t\n
                  \n
                  \n\t
                  \n\t\tMenu

                  ESPN

                  • \n\n
                    \n\t\n\t
                    \n\t\t\n\t
                    \n
                  • scores
                  \n\t
                  \n\t\n\n\n\n\n\n\n\n\n\n
                  \n\t\t\t
                  \n\n\n
                  \n\n
                  \n\n\t\t\t\t
                  \n\n \t
                  \n\n
                  \n \n\n\t\t\t\t\t\n\n\n
                  \n\n \n\n
                  \n\t
                  \n\t\t

                  2022 College Football Rankings - Postseason

                  \n\n\t\t\n\t
                  \n\n\t
                  \n\t\t\n\t
                  \n\n\n\n\t\t\t\n\t\t\t
                  \n\t\t\t\t
                  \n\t\t\t\t\t\n\t\t\t\t
                  \n\n\t\t\t\t
                  \n\t\t\t\t\t\n\t\t\t\t\t
                    \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2022
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2021
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2020
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2019
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2018
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2017
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2016
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2015
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2014
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2013
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2012
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2011
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2010
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2009
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2008
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2007
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2006
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2005
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2004
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2003
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • 2002
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
                  \n\t\t\t\t
                  \n\t\t\t\t
                  \n\n\t\t\t\t
                  \n\t\t\t\t\t\n\t\t\t\t\t
                    \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Preseason
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 2
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 3
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 4
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 5
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 6
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 7
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 8
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 9
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 10
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 11
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 12
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 13
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 14
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Week 15
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  • Final Rankings
                  • \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
                  \n\t\t\t\t
                  \n\n\t\t\t\t
                  \n\n\t\t\t
                  \n\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t
                  \n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
                  \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  \n\t\t\t\t\t\t\t\t\t

                  AP Top 25

                  RKTeamRecPtsTrend
                  1GeorgiaUGA(63)15-01575
                  2TCUTCU13-21484
                  3MichiganMICH13-11438
                  4Ohio StateOSU11-21394
                  5AlabamaALA11-21303
                  6TennesseeTENN11-21294
                  7Penn StatePSU11-21200
                  8WashingtonWASH11-21097
                  9TulaneTULN12-21025
                  10UtahUTAH10-4876
                  11Florida StateFSU10-3814
                  12USCUSC11-3795
                  13ClemsonCLEM11-3791
                  14Kansas StateKSU10-4784
                  15OregonORE10-3758
                  16LSULSU10-4757
                  17Oregon StateORST10-3742
                  18Notre DameND9-4535
                  19TroyTROY12-2322
                  20Mississippi StateMSST9-4320
                  21UCLAUCLA9-4243
                  22PittsburghPITT9-4233NR
                  23South CarolinaSC8-5180
                  24Fresno StateFRES10-4164NR
                  25TexasTEX8-595
                  Complete Rankings

                  Dropped from rankings: UTSA 22, NC State 25

                  Others receiving votes: Duke 49, UTSA 45, Air Force 40, Boise State 38, Minnesota 35, Texas Tech 19, North Carolina 8, NC State 6, Iowa 4, Purdue 3, Louisville 3, Marshall 2, Maryland 2, Cincinnati 1, Illinois 1

                  \n\t\t\t\t\t\t\t\t
                  \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
                  \n\t\t\t\t\t\t\t\t\t

                  AFCA Coaches Poll

                  RKTeamRecPtsTrend
                  1GeorgiaUGA(63)15-01575
                  2TCUTCU13-21482
                  3MichiganMICH13-11423
                  4Ohio StateOSU11-21404
                  5AlabamaALA11-21329
                  6TennesseeTENN11-21273
                  7Penn StatePSU11-21199
                  8WashingtonWASH11-21091
                  9TulaneTULN12-2981
                  10Florida StateFSU10-3926
                  11UtahUTAH10-4878
                  12ClemsonCLEM11-3839
                  13USCUSC11-3829
                  14Kansas StateKSU10-4769
                  15LSULSU10-4766
                  16OregonORE10-3708
                  17Oregon StateORST10-3690
                  18Notre DameND9-4498
                  19Mississippi StateMSST9-4364
                  20TroyTROY12-2314
                  21UCLAUCLA9-4238
                  22PittsburghPITT9-4193NR
                  23South CarolinaSC8-5164
                  24Fresno StateFRES10-4134NR
                  25TexasTEX8-569
                  Complete Rankings

                  Dropped from rankings: UTSA 22, North Carolina 25

                  Others receiving votes: UTSA 68, Minnesota 57, Air Force 50, Duke 47, North Carolina 35, Boise State 22, Texas Tech 13, Iowa 9, South Alabama 9, Ohio 6, Wake Forest 6, Maryland 4, Cincinnati 3, BYU 3, Louisville 3, UCF 2, Purdue 1, Ole Miss 1

                  \n\t\t\t\t\t\t\t\t
                  \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
                  \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
                  \n\t\t\t\t\n\t\t\t\n\n\t
                  \n\n
                  \n
                  \n \n
                  \n
                  \n

                  College Football News

                  \n
                  \n \n \n \n \n
                  \n \n
                  \n\n\n\n \n
                  \n\n \n\n
                  \n
                  \n
                  \n\t\t\n\n\n\n\t\t\n\n\t\t\n\t\t\t\n\t\t\n\t\n\n\t\n\n\n\n\n\t\t\t\n\t\t\t\n\n\t\n\t\n\n\t\n\n\n \n\n\t\t\n
                  \n \n\n\n\t\n" \ No newline at end of file diff --git a/test/tnns.test.js b/test/tennis.test.js similarity index 81% rename from test/tnns.test.js rename to test/tennis.test.js index 8d2d47f..43057a6 100644 --- a/test/tnns.test.js +++ b/test/tennis.test.js @@ -6,14 +6,14 @@ const app = require('../app/app'); describe('TNNS Scoreboard', () => { it('should populate scoreboard data for the current week and year', async () => { - const data = await app.tnns.getScoreboard({}); + const data = await app.tennis.getScoreboard({}); should(data).exist; should(data).be.json; should(data).not.be.empty; }); it('should populate scoreboard data for the current week and year and league', async () => { - const data = await app.tnns.getScoreboard({ league: "wta" }) + const data = await app.tennis.getScoreboard({ league: "wta" }) should(data).exist; should(data).be.json; should(data).not.be.empty; @@ -21,7 +21,7 @@ describe('TNNS Scoreboard', () => { }); it('should populate scoreboard data for the given week and year', async () => { - const data = await app.tnns.getScoreboard({ + const data = await app.tennis.getScoreboard({ year: 2021, month: 2, day: 15 @@ -33,7 +33,7 @@ describe('TNNS Scoreboard', () => { }); it('should return a promise for scoreboard data for the current week and year', async () => { - const data = await app.tnns.getScoreboard({}) + const data = await app.tennis.getScoreboard({}) should(data).exist; should(data).be.json; should(data).not.be.empty; @@ -41,7 +41,7 @@ describe('TNNS Scoreboard', () => { }); it('should return a promise for scoreboard data for the given week and year', async () => { - const data = await app.tnns.getScoreboard({ + const data = await app.tennis.getScoreboard({ year: 2021, month: 2, day: 15