From 9ef901f16e9aa181a34b46a3520c1377cb1e3b9f Mon Sep 17 00:00:00 2001 From: astone123 Date: Mon, 26 Aug 2024 12:25:38 -0400 Subject: [PATCH] add mock data for fixtures/:id --- e2e/e2e.ts | 3 +++ e2e/fixtures.cy.ts | 2 +- e2e/fixtures/fixture.json | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 e2e/fixtures/fixture.json diff --git a/e2e/e2e.ts b/e2e/e2e.ts index 2c550fa..89863ac 100644 --- a/e2e/e2e.ts +++ b/e2e/e2e.ts @@ -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'); }); diff --git a/e2e/fixtures.cy.ts b/e2e/fixtures.cy.ts index fd75ea3..c227c3e 100644 --- a/e2e/fixtures.cy.ts +++ b/e2e/fixtures.cy.ts @@ -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); }); diff --git a/e2e/fixtures/fixture.json b/e2e/fixtures/fixture.json new file mode 100644 index 0000000..0222ed3 --- /dev/null +++ b/e2e/fixtures/fixture.json @@ -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" + } +}