Skip to content

Commit

Permalink
test(e2e): fix e2e to use latest matchIds
Browse files Browse the repository at this point in the history
  • Loading branch information
OllieJennings committed Oct 5, 2023
1 parent c50ea02 commit 238f424
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions __tests__/e2e/match_v5.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
jest.unmock("@fightmegg/riot-rate-limiter");

import { count } from "console";
import "jest-extended";
import { PlatformId, RiotAPI } from "../../src/index";

jest.unmock("@fightmegg/riot-rate-limiter");

const riotAPIKey = process.env.X_RIOT_API_KEY || "";

describe("E2E", () => {
Expand All @@ -26,12 +25,21 @@ describe("E2E", () => {
test("getMatchById", async () => {
const rAPI = new RiotAPI(riotAPIKey);

const matchId = "EUW1_5350514472";
const matchIds = await rAPI.matchV5.getIdsByPuuid({
cluster: PlatformId.EUROPE,
puuid:
"8bJQbDi6uFIgefQA6Y79yxff_1bCHNopb1eHlq3p7Ic2oeXgYTvNnfGahtWyJ6qqAue3uK6wiZmMWQ",
params: {
start: 0,
count: 5,
},
});

const resp = await rAPI.matchV5.getMatchById({
cluster: PlatformId.EUROPE,
matchId,
matchId: matchIds[0],
});

expect(resp).toContainAllKeys(["metadata", "info"]);
expect(resp.info).toContainAllKeys([
"gameCreation",
Expand All @@ -49,17 +57,25 @@ describe("E2E", () => {
"teams",
"tournamentCode",
]);
expect(resp.metadata.matchId).toEqual(matchId);
expect(resp.metadata.matchId).toEqual(matchIds[0]);
});

test("getMatchTimelineById", async () => {
const rAPI = new RiotAPI(riotAPIKey);

const matchId = "EUW1_5350514472";
const matchIds = await rAPI.matchV5.getIdsByPuuid({
cluster: PlatformId.EUROPE,
puuid:
"8bJQbDi6uFIgefQA6Y79yxff_1bCHNopb1eHlq3p7Ic2oeXgYTvNnfGahtWyJ6qqAue3uK6wiZmMWQ",
params: {
start: 0,
count: 5,
},
});

const resp = await rAPI.matchV5.getMatchTimelineById({
cluster: PlatformId.EUROPE,
matchId,
matchId: matchIds[0],
});
expect(resp).toContainAllKeys(["metadata", "info"]);
expect(resp.info).toContainAnyKeys([
Expand All @@ -68,7 +84,7 @@ describe("E2E", () => {
"gameId",
"participants",
]);
expect(resp.metadata.matchId).toEqual(matchId);
expect(resp.metadata.matchId).toEqual(matchIds[0]);
});
});
});

0 comments on commit 238f424

Please sign in to comment.