Skip to content

Commit

Permalink
Merge pull request #225 from mkreiser/new-integration-test-seasons
Browse files Browse the repository at this point in the history
New integration test seasons
  • Loading branch information
mkreiser authored Sep 2, 2023
2 parents 1e5828b + 1e3d90c commit 4cae8ab
Show file tree
Hide file tree
Showing 9 changed files with 55,211 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`2016 season integration tests getHistoricalScoreboardForWeek returns a populated array of Boxscores 1`] = `
[
Boxscore {
"awayRoster": [],
"awayScore": 106.06,
"awayTeamId": 4,
"homeRoster": [],
"homeScore": 96.56,
"homeTeamId": 1,
},
Boxscore {
"awayRoster": [],
"awayScore": 87.86,
"awayTeamId": 2,
"homeRoster": [],
"homeScore": 86.32,
"homeTeamId": 9,
},
Boxscore {
"awayRoster": [],
"awayScore": 123.3,
"awayTeamId": 5,
"homeRoster": [],
"homeScore": 103.76,
"homeTeamId": 3,
},
Boxscore {
"awayRoster": [],
"awayScore": 94.72,
"awayTeamId": 8,
"homeRoster": [],
"homeScore": 109.6,
"homeTeamId": 12,
},
]
`;
34 changes: 34 additions & 0 deletions integration-tests/2016-season/integration.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'dotenv/config'; // Create a root .env file defining LEAGUE_ID, ESPN_S2, and SWID

import { Client } from '../../src/index';

jest.setTimeout(10000);

describe('2016 season integration tests', () => {
let client;
let leagueId;
let seasonId;
let scoringPeriodId;

beforeEach(() => {
leagueId = process.env.LEAGUE_ID;
seasonId = 2016;
scoringPeriodId = 1;

client = new Client({
leagueId,
espnS2: process.env.ESPN_S2,
SWID: process.env.SWID
});
});

describe('getHistoricalScoreboardForWeek', () => {
test('returns a populated array of Boxscores', async () => {
const scoreboards = await client.getHistoricalScoreboardForWeek({
seasonId, matchupPeriodId: scoringPeriodId, scoringPeriodId
});

expect(scoreboards).toMatchSnapshot();
});
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`client integration tests getBoxscoreForWeek returns a populated array of Boxscores 1`] = `
exports[`2018 season client integration tests getBoxscoreForWeek returns a populated array of Boxscores 1`] = `
[
Boxscore {
"awayRoster": [
Expand Down Expand Up @@ -7353,7 +7353,7 @@ exports[`client integration tests getBoxscoreForWeek returns a populated array o
]
`;

exports[`client integration tests getFreeAgents returns a populated array of FreeAgentPlayers 1`] = `
exports[`2018 season client integration tests getFreeAgents returns a populated array of FreeAgentPlayers 1`] = `
[
FreeAgentPlayer {
"player": Player {
Expand Down Expand Up @@ -44856,44 +44856,7 @@ exports[`client integration tests getFreeAgents returns a populated array of Fre
]
`;

exports[`client integration tests getHistoricalScoreboardForWeek returns a populated array of Boxscores 1`] = `
[
Boxscore {
"awayRoster": [],
"awayScore": 106.06,
"awayTeamId": 4,
"homeRoster": [],
"homeScore": 96.56,
"homeTeamId": 1,
},
Boxscore {
"awayRoster": [],
"awayScore": 87.86,
"awayTeamId": 2,
"homeRoster": [],
"homeScore": 86.32,
"homeTeamId": 9,
},
Boxscore {
"awayRoster": [],
"awayScore": 123.3,
"awayTeamId": 5,
"homeRoster": [],
"homeScore": 103.76,
"homeTeamId": 3,
},
Boxscore {
"awayRoster": [],
"awayScore": 94.72,
"awayTeamId": 8,
"homeRoster": [],
"homeScore": 109.6,
"homeTeamId": 12,
},
]
`;

exports[`client integration tests getLeagueInfo returns a populated League instance 1`] = `
exports[`2018 season client integration tests getLeagueInfo returns a populated League instance 1`] = `
League {
"draftSettings": {
"canTradeDraftPicks": false,
Expand Down Expand Up @@ -44963,7 +44926,7 @@ League {
}
`;

exports[`client integration tests getNFLGamesForPeriod returns a populated array of NFLGames 1`] = `
exports[`2018 season client integration tests getNFLGamesForPeriod returns a populated array of NFLGames 1`] = `
[
NFLGame {
"awayTeam": {
Expand Down Expand Up @@ -45283,7 +45246,7 @@ exports[`client integration tests getNFLGamesForPeriod returns a populated array
]
`;

exports[`client integration tests getTeamsAtWeek returns a populated array of Teams 1`] = `
exports[`2018 season client integration tests getTeamsAtWeek returns a populated array of Teams 1`] = `
[
Team {
"abbreviation": "GOAT",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'dotenv/config'; // Create a root .env file defining LEAGUE_ID, ESPN_S2, and SWID

import { Client } from '../src/index';
import { Client } from '../../src/index';

jest.setTimeout(10000);

describe('client integration tests', () => {
describe('2018 season client integration tests', () => {
let client;
let leagueId;
let seasonId;
Expand Down Expand Up @@ -32,20 +32,6 @@ describe('client integration tests', () => {
});
});

describe('getHistoricalScoreboardForWeek', () => {
beforeEach(() => {
seasonId = 2016;
});

test('returns a populated array of Boxscores', async () => {
const scoreboards = await client.getHistoricalScoreboardForWeek({
seasonId, matchupPeriodId: scoringPeriodId, scoringPeriodId
});

expect(scoreboards).toMatchSnapshot();
});
});

describe('getFreeAgents', () => {
test('returns a populated array of FreeAgentPlayers', async () => {
const players = await client.getFreeAgents({
Expand Down
Loading

0 comments on commit 4cae8ab

Please sign in to comment.