Skip to content

Commit

Permalink
add mock data for fixtures/:id
Browse files Browse the repository at this point in the history
  • Loading branch information
astone123 committed Aug 26, 2024
1 parent 8a017e5 commit 9ef901f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
3 changes: 3 additions & 0 deletions e2e/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ beforeEach(() => {
cy.intercept('GET', `${Cypress.env('API_BASE_URL')}/fixtures*`, {fixture: 'fixtures'}).as(
'fixtures'
);
cy.intercept('GET', `${Cypress.env('API_BASE_URL')}/fixtures/*`, {fixture: 'fixture'}).as(
'fixture'
);
cy.intercept('GET', `${Cypress.env('API_BASE_URL')}/goals*`, {fixture: 'goals'}).as('goals');
});
2 changes: 1 addition & 1 deletion e2e/fixtures.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('fixtures', () => {
expect(loc.pathname).to.eq('/fixtures/1049002');
});

cy.wait(['@goals', '@goals']).then((interceptions) => {
cy.wait(['@goals', '@goals', '@fixture']).then((interceptions) => {
const reqQuery = JSON.parse(interceptions[1].request.query.json as string);
cy.wrap(reqQuery).its('filter').its('fixtureId').should('equal', 1049002);
});
Expand Down
35 changes: 35 additions & 0 deletions e2e/fixtures/fixture.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"fixture": {
"id": 1208518,
"referee": "",
"date": "2024-08-26T12:30:00-07:00",
"timestamp": 0,
"teams": {
"home": {
"id": 533,
"name": "Villarreal",
"aliases": null,
"code": "",
"country": "",
"founded": 0,
"national": false,
"logo": "https://media.api-sports.io/football/teams/533.png",
"createdAt": ""
},
"away": {
"id": 538,
"name": "Celta Vigo",
"aliases": null,
"code": "",
"country": "",
"founded": 0,
"national": false,
"logo": "https://media.api-sports.io/football/teams/538.png",
"createdAt": ""
}
},
"leagueId": 140,
"season": 2024,
"createdAt": "2024-08-18T15:28:13.30605Z"
}
}

0 comments on commit 9ef901f

Please sign in to comment.